annotate src/goodjava/lucene/analysis/LowercaseAnalyzer.java @ 1828:09e90d94b7b5

add DomainFilter
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 15 Sep 2024 19:51:16 -0600
parents 13cbce740e1e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1474
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 package goodjava.lucene.analysis;
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 import java.io.Reader;
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 import org.apache.lucene.util.Version;
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 import org.apache.lucene.analysis.Analyzer;
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 import org.apache.lucene.analysis.Tokenizer;
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 import org.apache.lucene.analysis.TokenStream;
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 import org.apache.lucene.analysis.core.KeywordTokenizer;
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 import org.apache.lucene.analysis.core.LowerCaseFilter;
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 public final class LowercaseAnalyzer extends Analyzer {
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 private final Version matchVersion;
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 public LowercaseAnalyzer(Version matchVersion) {
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 this.matchVersion = matchVersion;
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 }
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 protected TokenStreamComponents createComponents( String fieldName, Reader reader ) {
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 Tokenizer source = new KeywordTokenizer(reader);
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 TokenStream filter = new LowerCaseFilter(matchVersion,source);
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 return new TokenStreamComponents(source,filter);
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 }
13cbce740e1e LowercaseAnalyzer
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 }