Mercurial Hosting > luan
annotate src/goodjava/lucene/api/MultiFieldParserConfig.java @ 1525:f848d40b3b07
lucene.api add boosts
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 18 Jul 2020 20:41:47 -0600 |
parents | 3ab0d043370f |
children | 3bd4d7963456 |
rev | line source |
---|---|
1460 | 1 package goodjava.lucene.api; |
2 | |
3 import java.util.Map; | |
4 import java.util.Collections; | |
5 import org.apache.lucene.analysis.Analyzer; | |
6 import org.apache.lucene.analysis.core.KeywordAnalyzer; | |
7 import goodjava.lucene.queryparser.MultiFieldParser; | |
8 import goodjava.lucene.queryparser.FieldParser; | |
9 import goodjava.lucene.queryparser.StringFieldParser; | |
10 | |
11 | |
12 public class MultiFieldParserConfig implements GoodIndexWriterConfig { | |
13 private final MultiFieldParser mfp; | |
14 | |
15 public MultiFieldParserConfig(MultiFieldParser mfp) { | |
16 this.mfp = mfp; | |
17 } | |
18 | |
19 public final boolean isIndexed(String fieldName) { | |
20 return mfp.fields.containsKey(fieldName); | |
21 } | |
22 | |
23 public final Analyzer getAnalyzer(String fieldName) { | |
24 FieldParser fp = mfp.fields.get(fieldName); | |
25 if( !(fp instanceof StringFieldParser) ) | |
26 return null; | |
27 StringFieldParser sfp = (StringFieldParser)fp; | |
28 Analyzer analyzer = sfp.analyzer; | |
29 return analyzer instanceof KeywordAnalyzer ? null : analyzer; | |
30 } | |
31 | |
1525
f848d40b3b07
lucene.api add boosts
Franklin Schmidt <fschmidt@gmail.com>
parents:
1460
diff
changeset
|
32 private static final MoreFieldInfo noMoreFieldInfo = new MoreFieldInfo(Collections.emptyMap(),Collections.emptyMap()); |
f848d40b3b07
lucene.api add boosts
Franklin Schmidt <fschmidt@gmail.com>
parents:
1460
diff
changeset
|
33 |
f848d40b3b07
lucene.api add boosts
Franklin Schmidt <fschmidt@gmail.com>
parents:
1460
diff
changeset
|
34 public MoreFieldInfo getMoreFieldInfo(Map<String,Object> storedFields) { |
f848d40b3b07
lucene.api add boosts
Franklin Schmidt <fschmidt@gmail.com>
parents:
1460
diff
changeset
|
35 return noMoreFieldInfo; |
1460 | 36 } |
37 } |