comparison src/goodjava/lucene/analysis/LowercaseAnalyzer.java @ 1474:13cbce740e1e

LowercaseAnalyzer
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 17 Apr 2020 21:53:09 -0600
parents
children
comparison
equal deleted inserted replaced
1473:6c6ce14db6a8 1474:13cbce740e1e
1 package goodjava.lucene.analysis;
2
3 import java.io.Reader;
4 import org.apache.lucene.util.Version;
5 import org.apache.lucene.analysis.Analyzer;
6 import org.apache.lucene.analysis.Tokenizer;
7 import org.apache.lucene.analysis.TokenStream;
8 import org.apache.lucene.analysis.core.KeywordTokenizer;
9 import org.apache.lucene.analysis.core.LowerCaseFilter;
10
11
12 public final class LowercaseAnalyzer extends Analyzer {
13 private final Version matchVersion;
14
15 public LowercaseAnalyzer(Version matchVersion) {
16 this.matchVersion = matchVersion;
17 }
18
19 protected TokenStreamComponents createComponents( String fieldName, Reader reader ) {
20 Tokenizer source = new KeywordTokenizer(reader);
21 TokenStream filter = new LowerCaseFilter(matchVersion,source);
22 return new TokenStreamComponents(source,filter);
23 }
24 }