org.apache.solr.handler.dataimport

## 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 and Description
    --- | ---
    `protected static class` | `Evaluator.VariableWrapper`

  - ### Field Summary

    Fields
    Modifier and Type | Field and 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 and Description
    `Evaluator()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract String` | `evaluate(String expression, Context context)` Return a String after processing an expression and a `VariableResolver`
    `protected Evaluator.VariableWrapper` | `getVariableWrapper(String s, VariableResolver vr)`
    `protected List<Object>` | `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

    - #### Evaluator

          public Evaluator()

  - ### Method Detail

    - #### evaluate

          public abstract String evaluate(String expression,
                                          Context context)

      Return a String after processing an expression and a `VariableResolver`
      Parameters:
        `expression` - string to be evaluated
        `context` - 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 parsed
        `vr` - 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)

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.