-
-
Save umeshdangat/0c0000d23eae1f9fc51d2103c0c5dfd9 to your computer and use it in GitHub Desktop.
ElasticsearchPlugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class YelpSearchNativeScriptFactory implements NativeScriptFactory { | |
public ExecutableScript newScript(@Nullable Map<String, Object> params) { | |
Scorer scorer = moduleLoader.createScorer(params)); | |
return new ExecutableScriptImpl(scorer); //1. Create elasticsearch executable script | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExecutableScriptImpl extends AbstractDoubleSearchScript implements Document { | |
public ExecutableScriptImpl(final Scorer scorer) { | |
this.scorer = scorer; | |
} | |
public double runAsDouble() { | |
return scorer.score(this); //1. score this document | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment