public class BoostingQueryBuilder extends QueryBuilder implements BoostableQueryBuilder<BoostingQueryBuilder>
Query balancedQuery = new BoostingQuery(positiveQuery, negativeQuery, 0.01f); In this scenario the positiveQuery contains the mandatory, desirable criteria which is used to select all matching documents, and the negativeQuery contains the undesirable elements which are simply used to lessen the scores. Documents that match the negativeQuery have their score multiplied by the supplied "boost" parameter, so this should be less than 1 to achieve a demoting effect
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsEMPTY_PARAMS| Constructor and Description |
|---|
BoostingQueryBuilder() |
| Modifier and Type | Method and Description |
|---|---|
BoostingQueryBuilder |
boost(float boost)
Sets the boost for this query.
|
protected void |
doXContent(XContentBuilder builder,
ToXContent.Params params) |
BoostingQueryBuilder |
negative(QueryBuilder negativeQuery) |
BoostingQueryBuilder |
negativeBoost(float negativeBoost) |
BoostingQueryBuilder |
positive(QueryBuilder positiveQuery) |
toXContentbuildAsBytes, buildAsBytes, toStringpublic BoostingQueryBuilder positive(QueryBuilder positiveQuery)
public BoostingQueryBuilder negative(QueryBuilder negativeQuery)
public BoostingQueryBuilder negativeBoost(float negativeBoost)
public BoostingQueryBuilder boost(float boost)
BoostableQueryBuilderboost in interface BoostableQueryBuilder<BoostingQueryBuilder>protected void doXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
doXContent in class QueryBuilderIOExceptionCopyright © 2009–2017. All rights reserved.