Return-Path: Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: (qmail 30101 invoked from network); 8 Apr 2011 20:53:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Apr 2011 20:53:48 -0000 Received: (qmail 73920 invoked by uid 500); 8 Apr 2011 20:53:44 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 73852 invoked by uid 500); 8 Apr 2011 20:53:44 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 73579 invoked by uid 99); 8 Apr 2011 20:53:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Apr 2011 20:53:43 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Apr 2011 20:53:42 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id CDE1699E09 for ; Fri, 8 Apr 2011 20:53:05 +0000 (UTC) Date: Fri, 8 Apr 2011 20:53:05 +0000 (UTC) From: "Robert Zotter (JIRA)" To: dev@lucene.apache.org Message-ID: <444236700.44932.1302295985840.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1355534620.44928.1302295745723.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (SOLR-2463) Using an evaluator outside the scope of an entity results in a null context MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SOLR-2463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Robert Zotter updated SOLR-2463: -------------------------------- Description: When using an Evaluator outside an entity element the Context argument is null. {code:title=foo.LowerCaseFunctionEvaluator.java|borderStyle=solid} 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(); } } {code} {code:title=data-config.xml|borderStyle=solid} {code} {code:title=data-config.xml|borderStyle=solid} {code} This use case worked in 1.4 was: When using an Evaluator outside an entity element the Context argument is null. {code:title=foo.LowerCaseFunctionEvaluator.java|borderStyle=solid} 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(); } } {code} {code:title=data-config.xml|borderStyle=solid} {code} {code:title=data-config.xml|borderStyle=solid} {code} > Using an evaluator outside the scope of an entity results in a null context > --------------------------------------------------------------------------- > > Key: SOLR-2463 > URL: https://issues.apache.org/jira/browse/SOLR-2463 > Project: Solr > Issue Type: Bug > Components: contrib - DataImportHandler > Affects Versions: 3.1, 3.1.1, 4.0 > Reporter: Robert Zotter > Priority: Minor > > When using an Evaluator outside an entity element the Context argument is null. > {code:title=foo.LowerCaseFunctionEvaluator.java|borderStyle=solid} > 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(); > } > } > {code} > {code:title=data-config.xml|borderStyle=solid} > type="..." > driver="..." > url="..." > user="${dataimporter.functions.toLowerCase('THIS_WILL_NOT_WORK')}" > password="..."/> > {code} > {code:title=data-config.xml|borderStyle=solid} > dataSource="..." > query="select * from ${dataimporter.functions.toLowerCase('THIS_WILL_WORK')}"/> > {code} > This use case worked in 1.4 -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org