EvaluatorBag (Solr 3.6.2 API)
Keywords: org.apache.solr.handler.dataimport.EvaluatorBag class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.solr.handler.dataimport
Class EvaluatorBag

    java.lang.Object
      org.apache.solr.handler.dataimport.EvaluatorBag

    public class EvaluatorBag

extends Object

Holds definitions for evaluators provided by DataImportHandler

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
Version:
  $Id: EvaluatorBag.java 1149112 2011-07-21 11:02:46Z shalin $

Nested Class Summary
`static class` | `EvaluatorBag.VariableWrapper`

Field Summary
`static String` | `DATE_FORMAT_EVALUATOR`
`static String` | `ESCAPE_SOLR_QUERY_CHARS`
`static String` | `SQL_ESCAPE_EVALUATOR`
`static String` | `URL_ENCODE_EVALUATOR`

Constructor Summary
`EvaluatorBag()`

Method Summary
`static Evaluator` | `getDateFormatEvaluator()` Returns an `Evaluator` instance capable of formatting values using a given date format.
`static Evaluator` | `getSolrQueryEscapingEvaluator()` Returns an `Evaluator` instance meant to be used for escaping reserved characters in Solr queries
`static Evaluator` | `getSqlEscapingEvaluator()` Returns an `Evaluator` instance meant to be used for escaping values in SQL queries.
`static Evaluator` | `getUrlEvaluator()` Returns an `Evaluator` instance capable of URL-encoding expressions.
`static List` | `parseParams(String expression, VariableResolver vr)` Parses a string of expression into separate params.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

Constructor Detail

### EvaluatorBag

    public EvaluatorBag()

Method Detail

### getSqlEscapingEvaluator

    public static Evaluator getSqlEscapingEvaluator()

  Returns an `Evaluator` instance meant to be used for escaping values in SQL queries.

  It escapes the value of the given expression by replacing all occurrences of single-quotes by two single-quotes and similarily for double-quotes

  Returns:
    an `Evaluator` instance capable of SQL-escaping expressions.

### getSolrQueryEscapingEvaluator

    public static Evaluator getSolrQueryEscapingEvaluator()

  Returns an `Evaluator` instance meant to be used for escaping reserved characters in Solr queries

  Returns:
    an `Evaluator` instance capable of escaping reserved characters in solr queries.
  See Also:
    `ClientUtils.escapeQueryChars(String)`

### getUrlEvaluator

    public static Evaluator getUrlEvaluator()

  Returns an `Evaluator` instance capable of URL-encoding expressions. The expressions are evaluated using a `VariableResolver`

  Returns:
    an `Evaluator` instance capable of URL-encoding expressions.

### getDateFormatEvaluator

    public static Evaluator getDateFormatEvaluator()

  Returns an `Evaluator` instance capable of formatting values using a given date format.

  The value to be formatted can be a entity.field or a date expression parsed with `DateMathParser` class. If the value is in a String, then it is assumed to be a datemath expression, otherwise it resolved using a `VariableResolver` instance

  Returns:
    an Evaluator instance capable of formatting values to a given date format
  See Also:
    `DateMathParser`

### parseParams

    public static List 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 parsed
    `vr` - the VariableResolver instance for resolving variables
  Returns:
    a List of objects which can either be a string, number or a variable wrapper

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD