Java api: add missing boost support to GeoShapeQueryBuilder
Relates to #11744 Relates to #11810
This commit is contained in:
parent
d32443bfb5
commit
e7702468a2
|
@ -29,7 +29,7 @@ import java.io.IOException;
|
|||
/**
|
||||
* {@link QueryBuilder} that builds a GeoShape Filter
|
||||
*/
|
||||
public class GeoShapeQueryBuilder extends QueryBuilder {
|
||||
public class GeoShapeQueryBuilder extends QueryBuilder implements BoostableQueryBuilder<GeoShapeQueryBuilder> {
|
||||
|
||||
private final String name;
|
||||
|
||||
|
@ -46,6 +46,8 @@ public class GeoShapeQueryBuilder extends QueryBuilder {
|
|||
private String indexedShapePath;
|
||||
|
||||
private ShapeRelation relation = null;
|
||||
|
||||
private float boost = -1;
|
||||
|
||||
/**
|
||||
* Creates a new GeoShapeQueryBuilder whose Filter will be against the
|
||||
|
@ -146,6 +148,12 @@ public class GeoShapeQueryBuilder extends QueryBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeoShapeQueryBuilder boost(float boost) {
|
||||
this.boost = boost;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
builder.startObject(GeoShapeQueryParser.NAME);
|
||||
|
@ -177,6 +185,10 @@ public class GeoShapeQueryBuilder extends QueryBuilder {
|
|||
|
||||
builder.endObject();
|
||||
|
||||
if (boost != -1) {
|
||||
builder.field("boost", boost);
|
||||
}
|
||||
|
||||
if (name != null) {
|
||||
builder.field("_name", queryName);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue