You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2011/07/11 12:46:35 UTC
[Solr Wiki] Update of "DIHCustomFunctions" by FrankWesemann
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The "DIHCustomFunctions" page has been changed by FrankWesemann:
http://wiki.apache.org/solr/DIHCustomFunctions?action=diff&rev1=3&rev2=4
Comment:
the example has to extend Evaluator ( it is not an interface )
= Custom Functions for DIH =
It is possible to plug in custom functions into DIH. Implement an [[http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/Evaluator.java?view=markup|Evaluator]] and specify it in the data-config.xml . Following is an example of an evaluator which does a 'toLowerCase' on a String.
+
{{{
<dataConfig>
<function name="toLowerCase" class="foo.LowerCaseFunctionEvaluator"/>
@@ -11, +12 @@
</entity>
</dataConfig>
}}}
+ The implementation of !LowerCaseFunctionEvaluator
- The implementation of !LowerCaseFunctionEvaluator
{{{
- public class LowerCaseFunctionEvaluator implements Evaluator{
+ public class LowerCaseFunctionEvaluator extends Evaluator{
public String evaluate(String expression, Context context) {
List l = EvaluatorBag.parseParams(expression, context.getVariableResolver());