Class Evaluator
- java.lang.Object
-
- org.apache.solr.handler.dataimport.Evaluator
-
- Direct Known Subclasses:
DateFormatEvaluator
,SolrQueryEscapingEvaluator
,SqlEscapingEvaluator
,UrlEvaluator
public abstract class Evaluator extends Object
Pluggable functions for resolving variables
Implementations of this abstract class must provide a public no-arg constructor.
Refer to http://wiki.apache.org/solr/DataImportHandler for more details.
This API is experimental and may change in the future.- Since:
- solr 1.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Evaluator.VariableWrapper
-
Field Summary
Fields Modifier and Type Field Description static String
DATE_FORMAT_EVALUATOR
static String
ESCAPE_SOLR_QUERY_CHARS
static String
SQL_ESCAPE_EVALUATOR
static String
URL_ENCODE_EVALUATOR
-
Constructor Summary
Constructors Constructor Description Evaluator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract String
evaluate(String expression, Context context)
Return a String after processing an expression and aVariableResolver
protected Evaluator.VariableWrapper
getVariableWrapper(String s, VariableResolver vr)
protected List<Object>
parseParams(String expression, VariableResolver vr)
Parses a string of expression into separate params.
-
-
-
Field Detail
-
DATE_FORMAT_EVALUATOR
public static final String DATE_FORMAT_EVALUATOR
- See Also:
- Constant Field Values
-
URL_ENCODE_EVALUATOR
public static final String URL_ENCODE_EVALUATOR
- See Also:
- Constant Field Values
-
ESCAPE_SOLR_QUERY_CHARS
public static final String ESCAPE_SOLR_QUERY_CHARS
- See Also:
- Constant Field Values
-
SQL_ESCAPE_EVALUATOR
public static final String SQL_ESCAPE_EVALUATOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
evaluate
public abstract String evaluate(String expression, Context context)
Return a String after processing an expression and aVariableResolver
- Parameters:
expression
- string to be evaluatedcontext
- instance- Returns:
- the value of the given expression evaluated using the resolver
- See Also:
VariableResolver
-
parseParams
protected List<Object> parseParams(String expression, VariableResolver vr)
Parses a string of expression into separate params. The values are separated by commas. each value will be translated into one of the following: <ol> <li>If it is in single quotes the value will be translated to a String</li> <li>If is is not in quotes and is a number a it will be translated into a Double</li> <li>else it is a variable which can be resolved and it will be put in as an instance of VariableWrapper</li> </ol>- Parameters:
expression
- the expression to be parsedvr
- the VariableResolver instance for resolving variables- Returns:
- a List of objects which can either be a string, number or a variable wrapper
-
getVariableWrapper
protected Evaluator.VariableWrapper getVariableWrapper(String s, VariableResolver vr)
-
-