I'm trying to write a SearchPlugin to do custom scoring, but I can't figure out how to access the doc values in my leaf score function.
The LeafScoreFunction.score() method takes a docId parameter. Is there a way to use that to get to the doc values.
Also, where is the proper place to get access to the document? In the LeafScoreFunction methods? Should I get access to it in the ScoreFunction.getLeafScoreFunction() method and pass it in to my LeafScoreFunction? Somewhere else?
Thank you very much for helping.
It looks like you are attempting to implement a FunctionScoreQuery. This class doesn't itself know anything about Lucene, only some implementations do (like ScriptScoreFunction). Maybe consider using an advanced script instead. The docs for writing native scripts (through a custom script engine) explain how to access Lucene data structures.
Thank you Ryan, that sent me in the right direction.
The ExplainableScript integration test was also very helpful.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.