|
20 | 20 | package org.elasticsearch.index.search;
|
21 | 21 |
|
22 | 22 | import org.apache.lucene.analysis.Analyzer;
|
23 |
| -import org.apache.lucene.analysis.miscellaneous.DisableGraphAttribute; |
24 | 23 | import org.apache.lucene.analysis.TokenStream;
|
| 24 | +import org.apache.lucene.analysis.miscellaneous.DisableGraphAttribute; |
25 | 25 | import org.apache.lucene.index.IndexOptions;
|
26 | 26 | import org.apache.lucene.index.Term;
|
27 | 27 | import org.apache.lucene.queries.ExtendedCommonTermsQuery;
|
28 | 28 | import org.apache.lucene.search.BooleanClause;
|
29 | 29 | import org.apache.lucene.search.BooleanClause.Occur;
|
30 | 30 | import org.apache.lucene.search.BooleanQuery;
|
31 | 31 | import org.apache.lucene.search.BoostQuery;
|
32 |
| -import org.apache.lucene.search.DisjunctionMaxQuery; |
33 | 32 | import org.apache.lucene.search.FuzzyQuery;
|
34 | 33 | import org.apache.lucene.search.MultiPhraseQuery;
|
35 | 34 | import org.apache.lucene.search.MultiTermQuery;
|
@@ -283,7 +282,7 @@ public Query parse(Type type, String fieldName, Object value) throws IOException
|
283 | 282 | if (commonTermsCutoff == null) {
|
284 | 283 | query = builder.createBooleanQuery(field, value.toString(), occur);
|
285 | 284 | } else {
|
286 |
| - query = builder.createCommonTermsQuery(field, value.toString(), occur, occur, commonTermsCutoff, fieldType); |
| 285 | + query = builder.createCommonTermsQuery(field, value.toString(), occur, occur, commonTermsCutoff); |
287 | 286 | }
|
288 | 287 | break;
|
289 | 288 | case PHRASE:
|
@@ -463,20 +462,23 @@ private Query toSpanQueryPrefix(SpanQuery query, float boost) {
|
463 | 462 | }
|
464 | 463 | }
|
465 | 464 |
|
466 |
| - public Query createCommonTermsQuery(String field, String queryText, Occur highFreqOccur, Occur lowFreqOccur, float |
467 |
| - maxTermFrequency, MappedFieldType fieldType) { |
| 465 | + public Query createCommonTermsQuery(String field, String queryText, |
| 466 | + Occur highFreqOccur, |
| 467 | + Occur lowFreqOccur, |
| 468 | + float maxTermFrequency) { |
468 | 469 | Query booleanQuery = createBooleanQuery(field, queryText, lowFreqOccur);
|
469 | 470 | if (booleanQuery != null && booleanQuery instanceof BooleanQuery) {
|
470 | 471 | BooleanQuery bq = (BooleanQuery) booleanQuery;
|
471 |
| - return boolToExtendedCommonTermsQuery(bq, highFreqOccur, lowFreqOccur, maxTermFrequency, fieldType); |
| 472 | + return boolToExtendedCommonTermsQuery(bq, highFreqOccur, lowFreqOccur, maxTermFrequency); |
472 | 473 | }
|
473 | 474 | return booleanQuery;
|
474 | 475 | }
|
475 | 476 |
|
476 |
| - private Query boolToExtendedCommonTermsQuery(BooleanQuery bq, Occur highFreqOccur, Occur lowFreqOccur, float |
477 |
| - maxTermFrequency, MappedFieldType fieldType) { |
478 |
| - ExtendedCommonTermsQuery query = new ExtendedCommonTermsQuery(highFreqOccur, lowFreqOccur, maxTermFrequency, |
479 |
| - fieldType); |
| 477 | + private Query boolToExtendedCommonTermsQuery(BooleanQuery bq, |
| 478 | + Occur highFreqOccur, |
| 479 | + Occur lowFreqOccur, |
| 480 | + float maxTermFrequency) { |
| 481 | + ExtendedCommonTermsQuery query = new ExtendedCommonTermsQuery(highFreqOccur, lowFreqOccur, maxTermFrequency); |
480 | 482 | for (BooleanClause clause : bq.clauses()) {
|
481 | 483 | if (!(clause.getQuery() instanceof TermQuery)) {
|
482 | 484 | return bq;
|
|
0 commit comments