Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix behavior on default boost factor for More Like This. #6021

Merged
merged 1 commit into from May 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/reference/query-dsl/queries/mlt-field-query.asciidoc
Expand Up @@ -58,7 +58,8 @@ ignored. Defaults to `0`. (Old name "min_word_len" is deprecated)
ignored. Defaults to unbounded (`0`). (Old name "max_word_len" is deprecated)

|`boost_terms` |Sets the boost factor to use when boosting terms.
Defaults to `1`.
Defaults to deactivated (`0`). Any other value activates boosting with given
boost factor.

|`boost` |Sets the boost value of the query. Defaults to `1.0`.

Expand Down
3 changes: 2 additions & 1 deletion docs/reference/query-dsl/queries/mlt-query.asciidoc
Expand Up @@ -57,7 +57,8 @@ ignored. Defaults to `0`.(Old name "min_word_len" is deprecated)
ignored. Defaults to unbounded (`0`). (Old name "max_word_len" is deprecated)

|`boost_terms` |Sets the boost factor to use when boosting terms.
Defaults to `1`.
Defaults to deactivated (`0`). Any other value activates boosting with given
boost factor.

|`boost` |Sets the boost value of the query. Defaults to `1.0`.

Expand Down
Expand Up @@ -91,8 +91,11 @@ public Query parse(QueryParseContext parseContext) throws IOException, QueryPars
} else if (MoreLikeThisQueryParser.Fields.MAX_WORD_LENGTH.match(currentFieldName,parseContext.parseFlags())) {
mltQuery.setMaxWordLen(parser.intValue());
} else if (MoreLikeThisQueryParser.Fields.BOOST_TERMS.match(currentFieldName,parseContext.parseFlags())) {
mltQuery.setBoostTerms(true);
mltQuery.setBoostTermsFactor(parser.floatValue());
float boostFactor = parser.floatValue();
if (boostFactor != 0) {
mltQuery.setBoostTerms(true);
mltQuery.setBoostTermsFactor(boostFactor);
}
} else if (MoreLikeThisQueryParser.Fields.PERCENT_TERMS_TO_MATCH.match(currentFieldName,parseContext.parseFlags())) {
mltQuery.setPercentTermsToMatch(parser.floatValue());
} else if ("analyzer".equals(currentFieldName)) {
Expand Down
Expand Up @@ -99,8 +99,11 @@ public Query parse(QueryParseContext parseContext) throws IOException, QueryPars
} else if (Fields.MAX_WORD_LENGTH.match(currentFieldName, parseContext.parseFlags())) {
mltQuery.setMaxWordLen(parser.intValue());
} else if (Fields.BOOST_TERMS.match(currentFieldName, parseContext.parseFlags())) {
mltQuery.setBoostTerms(true);
mltQuery.setBoostTermsFactor(parser.floatValue());
float boostFactor = parser.floatValue();
if (boostFactor != 0) {
mltQuery.setBoostTerms(true);
mltQuery.setBoostTermsFactor(boostFactor);
}
} else if (Fields.PERCENT_TERMS_TO_MATCH.match(currentFieldName, parseContext.parseFlags())) {
mltQuery.setPercentTermsToMatch(parser.floatValue());
} else if ("analyzer".equals(currentFieldName)) {
Expand Down