Add support for setting the boost to a text query in the Java client
This commit is contained in:
parent
b979af109c
commit
a9452bd0e6
|
@ -59,6 +59,8 @@ public class TextQueryBuilder extends BaseQueryBuilder {
|
||||||
|
|
||||||
private String analyzer;
|
private String analyzer;
|
||||||
|
|
||||||
|
private Float boost;
|
||||||
|
|
||||||
private Integer slop;
|
private Integer slop;
|
||||||
|
|
||||||
private String fuzziness;
|
private String fuzziness;
|
||||||
|
@ -100,6 +102,14 @@ public class TextQueryBuilder extends BaseQueryBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the boost to apply to the query.
|
||||||
|
*/
|
||||||
|
public TextQueryBuilder boost(float boost) {
|
||||||
|
this.boost = boost;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the phrase slop if evaluated to a phrase query type.
|
* Set the phrase slop if evaluated to a phrase query type.
|
||||||
*/
|
*/
|
||||||
|
@ -139,6 +149,9 @@ public class TextQueryBuilder extends BaseQueryBuilder {
|
||||||
if (analyzer != null) {
|
if (analyzer != null) {
|
||||||
builder.field("analyzer", analyzer);
|
builder.field("analyzer", analyzer);
|
||||||
}
|
}
|
||||||
|
if (boost != null) {
|
||||||
|
builder.field("boost", boost);
|
||||||
|
}
|
||||||
if (slop != null) {
|
if (slop != null) {
|
||||||
builder.field("slop", slop);
|
builder.field("slop", slop);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue