Java api: add missing boost support to GeoShapeQueryBuilder

Relates to #11744
Relates to #11810
This commit is contained in:
javanna 2015-06-22 18:32:20 +02:00 committed by Luca Cavanna
parent d32443bfb5
commit e7702468a2
1 changed files with 13 additions and 1 deletions

View File

@ -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;
@ -47,6 +47,8 @@ public class GeoShapeQueryBuilder extends QueryBuilder {
private ShapeRelation relation = null;
private float boost = -1;
/**
* Creates a new GeoShapeQueryBuilder whose Filter will be against the
* given field name using the given Shape
@ -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);
}