mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-20 03:45:02 +00:00
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
|
* {@link QueryBuilder} that builds a GeoShape Filter
|
||||||
*/
|
*/
|
||||||
public class GeoShapeQueryBuilder extends QueryBuilder {
|
public class GeoShapeQueryBuilder extends QueryBuilder implements BoostableQueryBuilder<GeoShapeQueryBuilder> {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
@ -47,6 +47,8 @@ public class GeoShapeQueryBuilder extends QueryBuilder {
|
|||||||
|
|
||||||
private ShapeRelation relation = null;
|
private ShapeRelation relation = null;
|
||||||
|
|
||||||
|
private float boost = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new GeoShapeQueryBuilder whose Filter will be against the
|
* Creates a new GeoShapeQueryBuilder whose Filter will be against the
|
||||||
* given field name using the given Shape
|
* given field name using the given Shape
|
||||||
@ -146,6 +148,12 @@ public class GeoShapeQueryBuilder extends QueryBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GeoShapeQueryBuilder boost(float boost) {
|
||||||
|
this.boost = boost;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doXContent(XContentBuilder builder, Params params) throws IOException {
|
protected void doXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
builder.startObject(GeoShapeQueryParser.NAME);
|
builder.startObject(GeoShapeQueryParser.NAME);
|
||||||
@ -177,6 +185,10 @@ public class GeoShapeQueryBuilder extends QueryBuilder {
|
|||||||
|
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
|
|
||||||
|
if (boost != -1) {
|
||||||
|
builder.field("boost", boost);
|
||||||
|
}
|
||||||
|
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
builder.field("_name", queryName);
|
builder.field("_name", queryName);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user