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

          Hide
          James Dyer added a comment -

          I wonder if this was fixed for SOLR 4.1 with SOLR-4086. Any chance someone can test this?

          Show
          James Dyer added a comment - I wonder if this was fixed for SOLR 4.1 with SOLR-4086 . Any chance someone can test this?
          Hide
          Robert Zotter added a comment -

          Still an issue in 3.6.1

          Show
          Robert Zotter added a comment - Still an issue in 3.6.1
          Hide
          Jeffrey Chang added a comment -

          I just tried delta-imports on 3.2, this is still unresolved. I also tried applying SOLR-2186 patch but no luck.

          Show
          Jeffrey Chang added a comment - I just tried delta-imports on 3.2, this is still unresolved. I also tried applying SOLR-2186 patch but no luck.
          Hide
          Frank Wesemann added a comment -

          it's not a problem of the Evaluators but of the DocBuilder
          see SOLR-2186

          Show
          Frank Wesemann added a comment - it's not a problem of the Evaluators but of the DocBuilder see SOLR-2186
          Hide
          Lance Norskog added a comment -

          How many Evaluators are there? I confess I have not seen this feature of DIH before. Are there unit tests for the feature, and its various permutations? If not, I would not rely on the feature.

          Show
          Lance Norskog added a comment - How many Evaluators are there? I confess I have not seen this feature of DIH before. Are there unit tests for the feature, and its various permutations? If not, I would not rely on the feature.
          Hide
          Robert Zotter added a comment -

          Also observing this behavior during delta-imports on deletedQuery and deletedPkQuery.

          <entity name="..."
                  dataSource="..."
                  query="..."
                  deltaQuery="select * from ${dataimporter.functions.toLowerCase('THIS_WILL_ALSO_NOT_WORK')}"
                  deletedPkQuery="select * from ${dataimporter.functions.toLowerCase('THIS_WILL_ALSO_NOT_WORK')}"/>
          
          Show
          Robert Zotter added a comment - Also observing this behavior during delta-imports on deletedQuery and deletedPkQuery. <entity name= "..." dataSource= "..." query= "..." deltaQuery= "select * from ${dataimporter.functions.toLowerCase('THIS_WILL_ALSO_NOT_WORK')}" deletedPkQuery= "select * from ${dataimporter.functions.toLowerCase('THIS_WILL_ALSO_NOT_WORK')}" />

            People

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

              Dates

              • Created:
                Updated:

                Development