|
19 | 19 |
|
20 | 20 | package org.apache.lucene.queryparser.classic; |
21 | 21 |
|
| 22 | +import com.google.common.collect.ImmutableMap; |
22 | 23 | import org.apache.lucene.analysis.Analyzer; |
23 | 24 | import org.apache.lucene.analysis.TokenStream; |
24 | 25 | import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; |
25 | 26 | import org.apache.lucene.index.Term; |
26 | | -import org.apache.lucene.search.BooleanClause; |
27 | | -import org.apache.lucene.search.DisjunctionMaxQuery; |
28 | | -import org.apache.lucene.search.FilteredQuery; |
29 | | -import org.apache.lucene.search.FuzzyQuery; |
30 | | -import org.apache.lucene.search.MatchNoDocsQuery; |
31 | | -import org.apache.lucene.search.MultiPhraseQuery; |
32 | | -import org.apache.lucene.search.PhraseQuery; |
33 | | -import org.apache.lucene.search.Query; |
34 | | -import org.apache.lucene.search.WildcardQuery; |
35 | | -import org.apache.lucene.util.Version; |
| 27 | +import org.apache.lucene.search.*; |
36 | 28 | import org.apache.lucene.util.automaton.RegExp; |
37 | 29 | import org.elasticsearch.common.lucene.search.Queries; |
38 | 30 | import org.elasticsearch.common.unit.Fuzziness; |
|
42 | 34 | import org.elasticsearch.index.query.QueryShardContext; |
43 | 35 | import org.elasticsearch.index.query.support.QueryParsers; |
44 | 36 |
|
45 | | -import com.google.common.collect.ImmutableMap; |
46 | | - |
47 | 37 | import java.io.IOException; |
48 | 38 | import java.util.ArrayList; |
49 | 39 | import java.util.Collection; |
@@ -83,7 +73,7 @@ public MapperQueryParser(QueryShardContext context) { |
83 | 73 |
|
84 | 74 | public void reset(QueryParserSettings settings) { |
85 | 75 | this.settings = settings; |
86 | | - if (settings.fieldsAndWeights().size() == 0) { |
| 76 | + if (settings.fieldsAndWeights().isEmpty()) { |
87 | 77 | this.field = settings.defaultField(); |
88 | 78 | } else if (settings.fieldsAndWeights().size() == 1) { |
89 | 79 | this.field = settings.fieldsAndWeights().keySet().iterator().next(); |
@@ -529,13 +519,6 @@ private Query getPossiblyAnalyzedPrefixQuery(String field, String termStr) throw |
529 | 519 | clauses.add(new BooleanClause(super.getPrefixQuery(field, token), BooleanClause.Occur.SHOULD)); |
530 | 520 | } |
531 | 521 | return getBooleanQuery(clauses, true); |
532 | | - |
533 | | - //return super.getPrefixQuery(field, termStr); |
534 | | - |
535 | | - // this means that the analyzer used either added or consumed (common for a stemmer) tokens, and we can't build a PrefixQuery |
536 | | - //throw new ParseException("Cannot build PrefixQuery with analyzer " |
537 | | - // + getAnalyzer().getClass() |
538 | | - // + (tlist.size() > 1 ? " - token(s) added" : " - token consumed")); |
539 | 522 | } |
540 | 523 |
|
541 | 524 | } |
|
0 commit comments