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
|
|
32 public Map<String,Object> getUnstoredFields(Map<String,Object> storedFields) {
|
|
33 return Collections.emptyMap();
|
|
34 }
|
|
35 }
|