From 27a7b0680c4ca074edbf9181ab36821e6d92bccd Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Sun, 13 Nov 2011 12:51:10 +0200 Subject: [PATCH] fix top_terms_boost parsing for multi term rewrite --- .../index/query/support/QueryParsers.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/support/QueryParsers.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/support/QueryParsers.java index 69ef1028581..a8751d6a195 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/support/QueryParsers.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/support/QueryParsers.java @@ -56,14 +56,6 @@ public final class QueryParsers { if ("constant_score_filter".equals(rewriteMethod) || "constantScoreFilter".equals(rewriteMethod)) { return MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE; } - if (rewriteMethod.startsWith("top_terms_")) { - int size = Integer.parseInt(rewriteMethod.substring("top_terms_".length())); - return new MultiTermQuery.TopTermsScoringBooleanQueryRewrite(size); - } - if (rewriteMethod.startsWith("topTerms")) { - int size = Integer.parseInt(rewriteMethod.substring("topTerms".length())); - return new MultiTermQuery.TopTermsScoringBooleanQueryRewrite(size); - } if (rewriteMethod.startsWith("top_terms_boost_")) { int size = Integer.parseInt(rewriteMethod.substring("top_terms_boost_".length())); return new MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite(size); @@ -72,6 +64,14 @@ public final class QueryParsers { int size = Integer.parseInt(rewriteMethod.substring("topTermsBoost".length())); return new MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite(size); } + if (rewriteMethod.startsWith("top_terms_")) { + int size = Integer.parseInt(rewriteMethod.substring("top_terms_".length())); + return new MultiTermQuery.TopTermsScoringBooleanQueryRewrite(size); + } + if (rewriteMethod.startsWith("topTerms")) { + int size = Integer.parseInt(rewriteMethod.substring("topTerms".length())); + return new MultiTermQuery.TopTermsScoringBooleanQueryRewrite(size); + } throw new ElasticSearchIllegalArgumentException("Failed to parse rewrite_method [" + rewriteMethod + "]"); }