Solr
  1. Solr
  2. SOLR-2463

Using an evaluator outside the scope of an entity results in a null context

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.1.1, 3.5, 3.6, 3.6.1, 4.0-ALPHA
    • Fix Version/s: 3.1.1
    • Labels:
      None

      Description

      When using an Evaluator outside an entity element the Context argument is null.

      foo.LowerCaseFunctionEvaluator.java
      public class LowerCaseFunctionEvaluator extends Evaluator {
       public String evaluate(String expression, Context context) {
         List l = EvaluatorBag.parseParams(expression, context.getVariableResolver());
         
         if (l.size() != 1) {
           throw new RuntimeException("'toLowerCase' must have only one parameter ");
         }
      
         return l.get(0).toString().toLowerCase();
       }
      }
      
      data-config.xml
      <dataSource name="..."
                  type="..."
                  driver="..."
                  url="..."
                  user="${dataimporter.functions.toLowerCase('THIS_WILL_NOT_WORK')}"
                  password="..."/>
      
      data-config.xml
      <entity name="..."
              dataSource="..."
              query="select * from ${dataimporter.functions.toLowerCase('THIS_WILL_WORK')}"/>
      

      This use case worked in 1.4

        Issue Links

          Activity

            People

            • Assignee:
              Shalin Shekhar Mangar
              Reporter:
              Robert Zotter
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Development