Class ExpressionOptimizer
java.lang.Object
com.yahoo.searchlib.rankingexpression.evaluation.ExpressionOptimizer
This class will perform various optimizations on the ranking expressions. Clients using optimized expressions
will do
// Set up once
RankingExpression expression = new RankingExpression(myExpressionString);
ArrayContext context = new ArrayContext(expression);
new ExpressionOptimizer().optimize(expression, context);
// Execute repeatedly
context.put("featureName1", value1);
...
expression.evaluate(context);
// Note that the expression may be used by multiple threads at the same time, while the
// context is single-threaded. To create a context for another tread, use the above context as a prototype,
// contextForOtherThread = context.clone();
Instances of this class are not multithread safe.
- Author:
- bratseth
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetOptimizer
(Class<?> clazz) Gets an optimizer instance used by this by class name, or null if the optimizer is not knownoptimize
(RankingExpression expression, AbstractArrayContext arrayContext) optimize
(RankingExpression expression, ContextIndex contextIndex)
-
Constructor Details
-
ExpressionOptimizer
public ExpressionOptimizer()
-
-
Method Details
-
getOptimizer
Gets an optimizer instance used by this by class name, or null if the optimizer is not known -
optimize
-
optimize
-