I am trying to create my customized ScriptEngine. In my case my data like
{
"body": "a b c a"
}
{
"body": "a b a a"
}
I want to access the body value "a b a a" during the ScoreScript.execute process. How I can do that?
private static class PureDfLeafFactory implements LeafFactory {
@Override
public ScoreScript newInstance(LeafReaderContext context)
throws IOException {
// is the any way to access field `body`'s value here
}
}
Is the body field analyzed? If it is, you'll need to copy the field to a keyword field which can be stored in doc values. Then access the field through the context.reader().getSortedSetDocValues() method.
Note that this is not advisable: doing string parsing in a scoring script is going to destroy performance.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.