Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@umeshdangat
Last active June 27, 2017 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umeshdangat/0c0000d23eae1f9fc51d2103c0c5dfd9 to your computer and use it in GitHub Desktop.
Save umeshdangat/0c0000d23eae1f9fc51d2103c0c5dfd9 to your computer and use it in GitHub Desktop.
ElasticsearchPlugin
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
}
}
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