add setting max boost on custom filters score query in the Java API as well

This commit is contained in:
Shay Banon 2012-05-23 23:49:17 +02:00
parent a64fcf77ee
commit 5cb3ea6ebc
1 changed files with 10 additions and 2 deletions

View File

@ -29,8 +29,6 @@ import java.util.Map;
/**
* A query that uses a filters with a script associated with them to compute the score.
*
*
*/
public class CustomFiltersScoreQueryBuilder extends BaseQueryBuilder {
@ -40,6 +38,8 @@ public class CustomFiltersScoreQueryBuilder extends BaseQueryBuilder {
private float boost = -1;
private Float maxBoost;
private Map<String, Object> params = null;
private String scoreMode;
@ -102,6 +102,11 @@ public class CustomFiltersScoreQueryBuilder extends BaseQueryBuilder {
return this;
}
public CustomFiltersScoreQueryBuilder maxBoost(float maxBoost) {
this.maxBoost = maxBoost;
return this;
}
/**
* Sets the boost for this query. Documents matching this query will (in addition to the normal
* weightings) have their score multiplied by the boost provided.
@ -135,6 +140,9 @@ public class CustomFiltersScoreQueryBuilder extends BaseQueryBuilder {
if (scoreMode != null) {
builder.field("score_mode", scoreMode);
}
if (maxBoost != null) {
builder.field("max_boost", maxBoost);
}
if (lang != null) {
builder.field("lang", lang);