Mercurial Hosting > luan
annotate src/goodjava/lucene/api/MultiFieldParserConfig.java @ 1630:b735ed134662
add nginx and ssl for host
author | fffilimonov |
---|---|
date | Fri, 10 Dec 2021 17:08:17 +0000 |
parents | 3bd4d7963456 |
children | f48db13ae2d9 |
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; | |
1528
3bd4d7963456
use goodjava/lucene/api
Franklin Schmidt <fschmidt@gmail.com>
parents:
1525
diff
changeset
|
7 import org.apache.lucene.index.IndexWriterConfig; |
3bd4d7963456
use goodjava/lucene/api
Franklin Schmidt <fschmidt@gmail.com>
parents:
1525
diff
changeset
|
8 import org.apache.lucene.util.Version; |
1460 | 9 import goodjava.lucene.queryparser.MultiFieldParser; |
10 import goodjava.lucene.queryparser.FieldParser; | |
11 import goodjava.lucene.queryparser.StringFieldParser; | |
12 | |
13 | |
14 public class MultiFieldParserConfig implements GoodIndexWriterConfig { | |
1528
3bd4d7963456
use goodjava/lucene/api
Franklin Schmidt <fschmidt@gmail.com>
parents:
1525
diff
changeset
|
15 private final Version luceneVersion; |
1460 | 16 private final MultiFieldParser mfp; |
17 | |
1528
3bd4d7963456
use goodjava/lucene/api
Franklin Schmidt <fschmidt@gmail.com>
parents:
1525
diff
changeset
|
18 public MultiFieldParserConfig(Version luceneVersion,MultiFieldParser mfp) { |
3bd4d7963456
use goodjava/lucene/api
Franklin Schmidt <fschmidt@gmail.com>
parents:
1525
diff
changeset
|
19 this.luceneVersion = luceneVersion; |
1460 | 20 this.mfp = mfp; |
21 } | |
22 | |
1528
3bd4d7963456
use goodjava/lucene/api
Franklin Schmidt <fschmidt@gmail.com>
parents:
1525
diff
changeset
|
23 public IndexWriterConfig newLuceneConfig() { |
3bd4d7963456
use goodjava/lucene/api
Franklin Schmidt <fschmidt@gmail.com>
parents:
1525
diff
changeset
|
24 return new IndexWriterConfig(luceneVersion,new FieldAnalyzer()); |
3bd4d7963456
use goodjava/lucene/api
Franklin Schmidt <fschmidt@gmail.com>
parents:
1525
diff
changeset
|
25 } |
3bd4d7963456
use goodjava/lucene/api
Franklin Schmidt <fschmidt@gmail.com>
parents:
1525
diff
changeset
|
26 |
1460 | 27 public final boolean isIndexed(String fieldName) { |
28 return mfp.fields.containsKey(fieldName); | |
29 } | |
30 | |
31 public final Analyzer getAnalyzer(String fieldName) { | |
32 FieldParser fp = mfp.fields.get(fieldName); | |
33 if( !(fp instanceof StringFieldParser) ) | |
34 return null; | |
35 StringFieldParser sfp = (StringFieldParser)fp; | |
36 Analyzer analyzer = sfp.analyzer; | |
37 return analyzer instanceof KeywordAnalyzer ? null : analyzer; | |
38 } | |
39 | |
1525
f848d40b3b07
lucene.api add boosts
Franklin Schmidt <fschmidt@gmail.com>
parents:
1460
diff
changeset
|
40 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
|
41 |
f848d40b3b07
lucene.api add boosts
Franklin Schmidt <fschmidt@gmail.com>
parents:
1460
diff
changeset
|
42 public MoreFieldInfo getMoreFieldInfo(Map<String,Object> storedFields) { |
f848d40b3b07
lucene.api add boosts
Franklin Schmidt <fschmidt@gmail.com>
parents:
1460
diff
changeset
|
43 return noMoreFieldInfo; |
1460 | 44 } |
45 } |