add setting max boost on custom filters score query in the Java API as well
This commit is contained in:
parent
a64fcf77ee
commit
5cb3ea6ebc
|
@ -29,8 +29,6 @@ import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A query that uses a filters with a script associated with them to compute the score.
|
* A query that uses a filters with a script associated with them to compute the score.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class CustomFiltersScoreQueryBuilder extends BaseQueryBuilder {
|
public class CustomFiltersScoreQueryBuilder extends BaseQueryBuilder {
|
||||||
|
|
||||||
|
@ -40,6 +38,8 @@ public class CustomFiltersScoreQueryBuilder extends BaseQueryBuilder {
|
||||||
|
|
||||||
private float boost = -1;
|
private float boost = -1;
|
||||||
|
|
||||||
|
private Float maxBoost;
|
||||||
|
|
||||||
private Map<String, Object> params = null;
|
private Map<String, Object> params = null;
|
||||||
|
|
||||||
private String scoreMode;
|
private String scoreMode;
|
||||||
|
@ -102,6 +102,11 @@ public class CustomFiltersScoreQueryBuilder extends BaseQueryBuilder {
|
||||||
return this;
|
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
|
* 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.
|
* weightings) have their score multiplied by the boost provided.
|
||||||
|
@ -135,6 +140,9 @@ public class CustomFiltersScoreQueryBuilder extends BaseQueryBuilder {
|
||||||
if (scoreMode != null) {
|
if (scoreMode != null) {
|
||||||
builder.field("score_mode", scoreMode);
|
builder.field("score_mode", scoreMode);
|
||||||
}
|
}
|
||||||
|
if (maxBoost != null) {
|
||||||
|
builder.field("max_boost", maxBoost);
|
||||||
|
}
|
||||||
|
|
||||||
if (lang != null) {
|
if (lang != null) {
|
||||||
builder.field("lang", lang);
|
builder.field("lang", lang);
|
||||||
|
|
Loading…
Reference in New Issue