Skip to content

Instantly share code, notes, and snippets.

@nik9000
Created April 25, 2014 15:59
Show Gist options
  • Save nik9000/11294459 to your computer and use it in GitHub Desktop.
Save nik9000/11294459 to your computer and use it in GitHub Desktop.
diff --git a/src/main/java/org/elasticsearch/index/analysis/AnalyzerProvider.java b/src/main/java/org/elasticsearch/index/analysis/AnalyzerProvider.java
index 7af8ae0..79053bf 100644
--- a/src/main/java/org/elasticsearch/index/analysis/AnalyzerProvider.java
+++ b/src/main/java/org/elasticsearch/index/analysis/AnalyzerProvider.java
@@ -32,4 +35,13 @@ public interface AnalyzerProvider<T extends Analyzer> extends Provider<T> {
AnalyzerScope scope();
T get();
+
+ /**
+ * Builds the custom analyzer configuration required to reproduce the
+ * default configuration of this analyzer.
+ *
+ * @param builder builder to which to append the analyzer
+ * @throws IOException if the builder throws it
+ */
+ void buildAsCustom(XContentBuilder builder) throws IOException;
}
diff --git a/src/main/java/org/elasticsearch/index/analysis/StandardAnalyzerProvider.java b/src/main/java/org/elasticsearch/index/analysis/StandardAnalyzerProvider.java
index b07aa48..e17b47f 100644
--- a/src/main/java/org/elasticsearch/index/analysis/StandardAnalyzerProvider.java
+++ b/src/main/java/org/elasticsearch/index/analysis/StandardAnalyzerProvider.java
@@ -60,4 +63,9 @@ public class StandardAnalyzerProvider extends AbstractIndexAnalyzerProvider<Stan
public StandardAnalyzer get() {
return this.standardAnalyzer;
}
+
+ @Override
+ public void buildAsCustom(XContentBuilder builder) throws IOException {
+ AnalyzerXContentUtil.buildAnalyzer(builder, "standard", "standard", "standard", "lowercase");
+ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment