Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
<artifactId>lucene-analyzers-kuromoji</artifactId>
<version>${lucene-version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-icu</artifactId>
<version>${lucene-version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-facet</artifactId>
Expand Down
8 changes: 8 additions & 0 deletions src/main/scala/com/cloudant/clouseau/SupportedAnalyzers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import org.apache.lucene.analysis.tr.TurkishAnalyzer
// Extras
import org.apache.lucene.analysis.ja.JapaneseTokenizer
import org.apache.lucene.analysis.miscellaneous.ASCIIFoldingFilter
import org.apache.lucene.analysis.icu.ICUFoldingFilter
import org.apache.lucene.analysis.core.LowerCaseFilter
import org.apache.lucene.analysis.core.LetterTokenizer

Expand Down Expand Up @@ -120,6 +121,13 @@ object SupportedAnalyzers {
new TokenStreamComponents(tokenizer, new ASCIIFoldingFilter(new LowerCaseFilter(IndexService.version, tokenizer)))
}
})
case "simple_icufolding" =>
Some(new Analyzer() {
def createComponents(fieldName: String, reader: Reader): TokenStreamComponents = {
val tokenizer: Tokenizer = new LetterTokenizer(IndexService.version, reader);
new TokenStreamComponents(tokenizer, new ICUFoldingFilter(tokenizer))
}
})
case "arabic" =>
options.get("stopwords") match {
case Some(stopwords: List[String]) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class AnalyzerServiceSpec extends SpecificationWithJUnit {
"demonstrate simple_asciifolding tokenization" in new analyzer_service {
service.handleCall(null, ('analyze, "simple_asciifolding", "Ayşegül Özbayır")) must be equalTo (('ok, List("aysegul", "ozbayir")))
}

"demonstrate simple_icufolding tokenization" in new analyzer_service {
service.handleCall(null, ('analyze, "simple_icufolding", "Ayşegül Özbayır")) must be equalTo (('ok, List("aysegul", "ozbayir")))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ class SupportedAnalyzersSpec extends SpecificationWithJUnit {
"simple_asciifolding" in {
createAnalyzer("simple_asciifolding") must haveClass[Some[Analyzer]]
}
"simple_icufolding" in {
createAnalyzer("simple_icufolding") must haveClass[Some[Analyzer]]
}
"email" in {
createAnalyzer("email") must haveClass[Some[UAX29URLEmailAnalyzer]]
}
Expand Down