Mercurial Hosting > luan
comparison src/goodjava/lucene/api/MultiFieldParserConfig.java @ 1460:3ab0d043370f
start lucene.api
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Mon, 23 Mar 2020 00:04:42 -0600 |
| parents | |
| children | f848d40b3b07 |
comparison
equal
deleted
inserted
replaced
| 1459:b04b8fc5f4f4 | 1460:3ab0d043370f |
|---|---|
| 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 } |
