Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add Snowball Analyzer.

  • Loading branch information...
commit 484bf405e18a8a2e025acef9b89cfc161ad6375b 1 parent 6dc569e
@rnewson authored
View
13 README.md
@@ -179,11 +179,24 @@ Lucene has numerous ways of converting free-form text into tokens, these classes
<li>porter</li>
<li>russian</li>
<li>simple</li>
+<li>snowball</li>
<li>standard</li>
<li>thai</li>
<li>whitespace</li>
</ul>
+<h4>The Snowball Analyzer</h4>
+
+This analyzer requires an extra argument to specify the language (see http://lucene.apache.org/java/3_0_3/api/contrib-snowball/org/apache/lucene/analysis/snowball/SnowballAnalyzer.html for details);
+
+<pre>
+"analyzer":"snowball:English"
+</pre>
+
+Note: the argument is case-sensitive and is passed directly to the <code>SnowballAnalyzer</code>'s constructor.
+
+<h4>The Per-field Analyzer"</h4>
+
The "perfield" option lets you use a different analyzer for different fields and is configured as follows;
<pre>
View
5 pom.xml
@@ -63,6 +63,11 @@
<version>${lucene-version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-snowball</artifactId>
+ <version>${lucene-version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
<version>${tika-version}</version>
View
7 src/main/java/com/github/rnewson/couchdb/lucene/util/Analyzers.java
@@ -35,6 +35,7 @@
import org.apache.lucene.analysis.fr.FrenchAnalyzer;
import org.apache.lucene.analysis.nl.DutchAnalyzer;
import org.apache.lucene.analysis.ru.RussianAnalyzer;
+import org.apache.lucene.analysis.snowball.SnowballAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.analysis.th.ThaiAnalyzer;
import org.json.JSONException;
@@ -130,6 +131,12 @@ public Analyzer newAnalyzer(final String args) {
return new SimpleAnalyzer();
}
},
+ SNOWBALL {
+ @Override
+ public Analyzer newAnalyzer(final String args) {
+ return new SnowballAnalyzer(Constants.VERSION, args);
+ }
+ },
STANDARD {
@Override
public Analyzer newAnalyzer(final String args) {
Please sign in to comment.
Something went wrong with that request. Please try again.