Browse Source

CONSOLEify some more docs

And expand on the `stemmer_override` examples, including the
file on disk and an example of specifying the rules inline.

Relates to #18160
Nik Everett 8 years ago
parent
commit
a783c6c85c

+ 1 - 3
docs/build.gradle

@@ -73,9 +73,6 @@ buildRestTests.expectedUnconvertedCandidates = [
   'reference/analysis/tokenfilters/keyword-repeat-tokenfilter.asciidoc',
   'reference/analysis/tokenfilters/limit-token-count-tokenfilter.asciidoc',
   'reference/analysis/tokenfilters/lowercase-tokenfilter.asciidoc',
-  'reference/analysis/tokenfilters/pattern-capture-tokenfilter.asciidoc',
-  'reference/analysis/tokenfilters/snowball-tokenfilter.asciidoc',
-  'reference/analysis/tokenfilters/stemmer-override-tokenfilter.asciidoc',
   'reference/cat/snapshots.asciidoc',
   'reference/cat/templates.asciidoc',
   'reference/cat/thread_pool.asciidoc',
@@ -140,6 +137,7 @@ integTestCluster {
   configFile 'scripts/my_combine_script.painless'
   configFile 'scripts/my_reduce_script.painless'
   configFile 'analysis/synonym.txt'
+  configFile 'analysis/stemmer_override.txt'
   configFile 'userdict_ja.txt'
   configFile 'KeywordTokenizer.rbbi'
   // Whitelist reindexing from the local node so we can test it.

+ 6 - 6
docs/reference/analysis/tokenfilters/pattern-capture-tokenfilter.asciidoc

@@ -23,14 +23,14 @@ Read more about http://www.regular-expressions.info/catastrophic.html[pathologic
 
 For instance a pattern like :
 
-[source,js]
+[source,text]
 --------------------------------------------------
 "(([a-z]+)(\d*))"
 --------------------------------------------------
 
 when matched against:
 
-[source,js]
+[source,text]
 --------------------------------------------------
 "abc123def456"
 --------------------------------------------------
@@ -74,7 +74,7 @@ PUT test
 
 When used to analyze the text
 
-[source,js]
+[source,java]
 --------------------------------------------------
 import static org.apache.commons.lang.StringEscapeUtils.escapeHtml
 --------------------------------------------------
@@ -117,7 +117,7 @@ PUT test
 
 When the above analyzer is used on an email address like:
 
-[source,js]
+[source,text]
 --------------------------------------------------
 john-smith_123@foo-bar.com
 --------------------------------------------------
@@ -136,14 +136,14 @@ original token will be highlighted, not just the matching subset. For
 instance, querying the above email address for `"smith"` would
 highlight:
 
-[source,js]
+[source,html]
 --------------------------------------------------
   <em>john-smith_123@foo-bar.com</em>
 --------------------------------------------------
 
 not:
 
-[source,js]
+[source,html]
 --------------------------------------------------
   john-<em>smith</em>_123@foo-bar.com
 --------------------------------------------------

+ 3 - 1
docs/reference/analysis/tokenfilters/snowball-tokenfilter.asciidoc

@@ -12,8 +12,9 @@ For example:
 
 [source,js]
 --------------------------------------------------
+PUT /my_index
 {
-    "index" : {
+    "settings": {
         "analysis" : {
             "analyzer" : {
                 "my_analyzer" : {
@@ -31,3 +32,4 @@ For example:
     }
 }
 --------------------------------------------------
+// CONSOLE

+ 56 - 11
docs/reference/analysis/tokenfilters/stemmer-override-tokenfilter.asciidoc

@@ -20,15 +20,60 @@ Here is an example:
 
 [source,js]
 --------------------------------------------------
-index :
-    analysis :
-        analyzer :
-            myAnalyzer :
-                type : custom
-                tokenizer : standard
-                filter : [lowercase, custom_stems, porter_stem]    
-        filter:
-            custom_stems:
-                type: stemmer_override
-                rules_path : analysis/custom_stems.txt
+PUT /my_index
+{
+    "settings": {
+        "analysis" : {
+            "analyzer" : {
+                "my_analyzer" : {
+                    "tokenizer" : "standard",
+                    "filter" : ["lowercase", "custom_stems", "porter_stem"]
+                }
+            },
+            "filter" : {
+                "custom_stems" : {
+                    "type" : "stemmer_override",
+                    "rules_path" : "analysis/stemmer_override.txt"
+                }
+            }
+        }
+    }
+}
 --------------------------------------------------
+// CONSOLE
+
+Where the file looks like:
+
+[source,stemmer_override]
+--------------------------------------------------
+include::{docdir}/../src/test/cluster/config/analysis/stemmer_override.txt[]
+--------------------------------------------------
+
+You can also define the overrides rules inline:
+
+[source,js]
+--------------------------------------------------
+PUT /my_index
+{
+    "settings": {
+        "analysis" : {
+            "analyzer" : {
+                "my_analyzer" : {
+                    "tokenizer" : "standard",
+                    "filter" : ["lowercase", "custom_stems", "porter_stem"]
+                }
+            },
+            "filter" : {
+                "custom_stems" : {
+                    "type" : "stemmer_override",
+                    "rules" : [
+                        "running => run",
+                        "stemmer => stemmer"
+                    ]
+                }
+            }
+        }
+    }
+}
+--------------------------------------------------
+// CONSOLE

+ 3 - 0
docs/src/test/cluster/config/analysis/stemmer_override.txt

@@ -0,0 +1,3 @@
+running => run
+
+stemmer => stemmer