-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathNativeScriptExamplesPlugin.java
More file actions
48 lines (43 loc) · 1.86 KB
/
Copy pathNativeScriptExamplesPlugin.java
File metadata and controls
48 lines (43 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package org.elasticsearch.examples.nativescript.plugin;
import org.elasticsearch.examples.nativescript.script.*;
import org.elasticsearch.plugins.AbstractPlugin;
import org.elasticsearch.script.ScriptModule;
/**
* This class is instantiated when Elasticsearch loads the plugin for the
* first time. If you change the name of this plugin, make sure to update
* src/main/resources/es-plugin.properties file that points to this class.
*/
public class NativeScriptExamplesPlugin extends AbstractPlugin {
/**
* The name of the plugin.
* <p/>
* This name will be used by elasticsearch in the log file to refer to this plugin.
*
* @return plugin name.
*/
@Override
public String name() {
return "native-script-example";
}
/**
* The description of the plugin.
*
* @return plugin description
*/
@Override
public String description() {
return "Native script examples";
}
public void onModule(ScriptModule module) {
// Register each script that we defined in this plugin
module.registerScript("is_prime", IsPrimeSearchScript.Factory.class);
module.registerScript("lookup", LookupScript.Factory.class);
module.registerScript("random", RandomSortScriptFactory.class);
module.registerScript("popularity", PopularityScoreScriptFactory.class);
module.registerScript(TFIDFScoreScript.SCRIPT_NAME, TFIDFScoreScript.Factory.class);
module.registerScript(CosineSimilarityScoreScript.SCRIPT_NAME, CosineSimilarityScoreScript.Factory.class);
module.registerScript(PhraseScoreScript.SCRIPT_NAME, PhraseScoreScript.Factory.class);
module.registerScript(LanguageModelScoreScript.SCRIPT_NAME, LanguageModelScoreScript.Factory.class);
module.registerScript(SplitTransformScript.SCRIPT_NAME, SplitTransformScript.Factory.class);
}
}