fix top_terms_boost parsing for multi term rewrite

This commit is contained in:
Shay Banon 2011-11-13 12:51:10 +02:00
parent 9cc0b7a28b
commit 27a7b0680c
1 changed files with 8 additions and 8 deletions

View File

@ -56,14 +56,6 @@ public final class QueryParsers {
if ("constant_score_filter".equals(rewriteMethod) || "constantScoreFilter".equals(rewriteMethod)) { if ("constant_score_filter".equals(rewriteMethod) || "constantScoreFilter".equals(rewriteMethod)) {
return MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE; 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_")) { if (rewriteMethod.startsWith("top_terms_boost_")) {
int size = Integer.parseInt(rewriteMethod.substring("top_terms_boost_".length())); int size = Integer.parseInt(rewriteMethod.substring("top_terms_boost_".length()));
return new MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite(size); return new MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite(size);
@ -72,6 +64,14 @@ public final class QueryParsers {
int size = Integer.parseInt(rewriteMethod.substring("topTermsBoost".length())); int size = Integer.parseInt(rewriteMethod.substring("topTermsBoost".length()));
return new MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite(size); 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 + "]"); throw new ElasticSearchIllegalArgumentException("Failed to parse rewrite_method [" + rewriteMethod + "]");
} }