mlt_field doesn't support boost, closes #1773.

This commit is contained in:
Shay Banon 2012-03-10 20:50:25 +02:00
parent e7a892f6f0
commit d9963926dc
3 changed files with 6 additions and 0 deletions

View File

@ -81,6 +81,8 @@ public class MoreLikeThisQuery extends Query {
BooleanClause[] clauses = bq.getClauses(); BooleanClause[] clauses = bq.getClauses();
bq.setMinimumNumberShouldMatch((int) (clauses.length * percentTermsToMatch)); bq.setMinimumNumberShouldMatch((int) (clauses.length * percentTermsToMatch));
bq.setBoost(getBoost());
return bq; return bq;
} }

View File

@ -92,6 +92,8 @@ public class MoreLikeThisFieldQueryParser implements QueryParser {
mltQuery.setPercentTermsToMatch(parser.floatValue()); mltQuery.setPercentTermsToMatch(parser.floatValue());
} else if ("analyzer".equals(currentFieldName)) { } else if ("analyzer".equals(currentFieldName)) {
analyzer = parseContext.analysisService().analyzer(parser.text()); analyzer = parseContext.analysisService().analyzer(parser.text());
} else if ("boost".equals(currentFieldName)) {
mltQuery.setBoost(parser.floatValue());
} else { } else {
throw new QueryParsingException(parseContext.index(), "[mlt_field] query does not support [" + currentFieldName + "]"); throw new QueryParsingException(parseContext.index(), "[mlt_field] query does not support [" + currentFieldName + "]");
} }

View File

@ -83,6 +83,8 @@ public class MoreLikeThisQueryParser implements QueryParser {
mltQuery.setPercentTermsToMatch(parser.floatValue()); mltQuery.setPercentTermsToMatch(parser.floatValue());
} else if ("analyzer".equals(currentFieldName)) { } else if ("analyzer".equals(currentFieldName)) {
analyzer = parseContext.analysisService().analyzer(parser.text()); analyzer = parseContext.analysisService().analyzer(parser.text());
} else if ("boost".equals(currentFieldName)) {
mltQuery.setBoost(parser.floatValue());
} else { } else {
throw new QueryParsingException(parseContext.index(), "[mlt] query does not support [" + currentFieldName + "]"); throw new QueryParsingException(parseContext.index(), "[mlt] query does not support [" + currentFieldName + "]");
} }