Mercurial Hosting > luan
view src/goodjava/lucene/api/MultiFieldParserConfig.java @ 1648:224af797b1f9
Mainly small install script improvements
- Consistent usage of `$LUANHOME`, removed reliance on current directory.
- Made Luan build and install fine (on Linux) without requiring launching it via sudo. Only asks to elevate privileges if installation failed.
- Minor spelling mistake fix.
author | Fox |
---|---|
date | Mon, 28 Mar 2022 18:00:12 +0200 |
parents | 3bd4d7963456 |
children | f48db13ae2d9 |
line wrap: on
line source
package goodjava.lucene.api; import java.util.Map; import java.util.Collections; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.core.KeywordAnalyzer; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.util.Version; import goodjava.lucene.queryparser.MultiFieldParser; import goodjava.lucene.queryparser.FieldParser; import goodjava.lucene.queryparser.StringFieldParser; public class MultiFieldParserConfig implements GoodIndexWriterConfig { private final Version luceneVersion; private final MultiFieldParser mfp; public MultiFieldParserConfig(Version luceneVersion,MultiFieldParser mfp) { this.luceneVersion = luceneVersion; this.mfp = mfp; } public IndexWriterConfig newLuceneConfig() { return new IndexWriterConfig(luceneVersion,new FieldAnalyzer()); } public final boolean isIndexed(String fieldName) { return mfp.fields.containsKey(fieldName); } public final Analyzer getAnalyzer(String fieldName) { FieldParser fp = mfp.fields.get(fieldName); if( !(fp instanceof StringFieldParser) ) return null; StringFieldParser sfp = (StringFieldParser)fp; Analyzer analyzer = sfp.analyzer; return analyzer instanceof KeywordAnalyzer ? null : analyzer; } private static final MoreFieldInfo noMoreFieldInfo = new MoreFieldInfo(Collections.emptyMap(),Collections.emptyMap()); public MoreFieldInfo getMoreFieldInfo(Map<String,Object> storedFields) { return noMoreFieldInfo; } }