Skip to content

Commit

Permalink
mlt_field doesn't support boost, closes elastic#1773.
Browse files Browse the repository at this point in the history
  • Loading branch information
kimchy committed Mar 10, 2012
1 parent e7a892f commit d996392
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Expand Up @@ -81,6 +81,8 @@ public Query rewrite(IndexReader reader) throws IOException {
BooleanClause[] clauses = bq.getClauses();

bq.setMinimumNumberShouldMatch((int) (clauses.length * percentTermsToMatch));

bq.setBoost(getBoost());
return bq;
}

Expand Down
Expand Up @@ -92,6 +92,8 @@ public Query parse(QueryParseContext parseContext) throws IOException, QueryPars
mltQuery.setPercentTermsToMatch(parser.floatValue());
} else if ("analyzer".equals(currentFieldName)) {
analyzer = parseContext.analysisService().analyzer(parser.text());
} else if ("boost".equals(currentFieldName)) {
mltQuery.setBoost(parser.floatValue());
} else {
throw new QueryParsingException(parseContext.index(), "[mlt_field] query does not support [" + currentFieldName + "]");
}
Expand Down
Expand Up @@ -83,6 +83,8 @@ public Query parse(QueryParseContext parseContext) throws IOException, QueryPars
mltQuery.setPercentTermsToMatch(parser.floatValue());
} else if ("analyzer".equals(currentFieldName)) {
analyzer = parseContext.analysisService().analyzer(parser.text());
} else if ("boost".equals(currentFieldName)) {
mltQuery.setBoost(parser.floatValue());
} else {
throw new QueryParsingException(parseContext.index(), "[mlt] query does not support [" + currentFieldName + "]");
}
Expand Down

0 comments on commit d996392

Please sign in to comment.