public class GeoBoundingBoxQueryBuilder extends AbstractQueryBuilder<GeoBoundingBoxQueryBuilder>
Writeable.Reader<R>
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_IGNORE_UNMAPPED
The default value for ignore_unmapped.
|
static GeoExecType |
DEFAULT_TYPE
Default type for executing this query (memory as of this writing).
|
static java.lang.String |
NAME
Name of the query.
|
static ParseField |
QUERY_NAME_FIELD |
boost, BOOST_FIELD, DEFAULT_BOOST, NAME_FIELD, queryName
EMPTY_PARAMS
Constructor and Description |
---|
GeoBoundingBoxQueryBuilder(StreamInput in)
Read from a stream.
|
GeoBoundingBoxQueryBuilder(java.lang.String fieldName)
Create new bounding box query.
|
Modifier and Type | Method and Description |
---|---|
GeoPoint |
bottomRight()
Returns the bottom right corner of the bounding box.
|
protected boolean |
doEquals(GeoBoundingBoxQueryBuilder other)
Indicates whether some other
QueryBuilder object of the same type is "equal to" this one. |
protected int |
doHashCode() |
org.apache.lucene.search.Query |
doToQuery(QueryShardContext context) |
protected void |
doWriteTo(StreamOutput out) |
protected void |
doXContent(XContentBuilder builder,
ToXContent.Params params) |
java.lang.String |
fieldName()
Returns the name of the field to base the bounding box computation on.
|
static GeoBoundingBoxQueryBuilder |
fromXContent(QueryParseContext parseContext) |
GeoValidationMethod |
getValidationMethod()
Returns geo coordinate validation method to use.
|
java.lang.String |
getWriteableName()
Returns the name of the writeable object
|
boolean |
ignoreUnmapped()
Gets whether the query builder will ignore unmapped fields (and run a
MatchNoDocsQuery in place of this query) or throw an exception if
the field is unmapped. |
GeoBoundingBoxQueryBuilder |
ignoreUnmapped(boolean ignoreUnmapped)
Sets whether the query builder should ignore unmapped fields (and run a
MatchNoDocsQuery in place of this query) or throw an exception if
the field is unmapped. |
GeoBoundingBoxQueryBuilder |
setCorners(double top,
double left,
double bottom,
double right)
Adds top left point.
|
GeoBoundingBoxQueryBuilder |
setCorners(GeoPoint topLeft,
GeoPoint bottomRight)
Adds points.
|
GeoBoundingBoxQueryBuilder |
setCorners(java.lang.String topLeft,
java.lang.String bottomRight)
Adds points.
|
GeoBoundingBoxQueryBuilder |
setCornersOGC(GeoPoint bottomLeft,
GeoPoint topRight)
Adds corners in OGC standard bbox/ envelop format.
|
GeoBoundingBoxQueryBuilder |
setCornersOGC(java.lang.String bottomLeft,
java.lang.String topRight)
Adds corners in OGC standard bbox/ envelop format.
|
GeoBoundingBoxQueryBuilder |
setValidationMethod(GeoValidationMethod method)
Specify whether or not to ignore validation errors of bounding boxes.
|
GeoPoint |
topLeft()
Returns the top left corner of the bounding box.
|
GeoExecType |
type()
Returns the execution type of the geo bounding box.
|
GeoBoundingBoxQueryBuilder |
type(GeoExecType type)
Sets the type of executing of the geo bounding box.
|
GeoBoundingBoxQueryBuilder |
type(java.lang.String type)
For BWC: Parse type from type name.
|
addValidationError, boost, boost, convertToBytesRefIfString, convertToStringIfBytesRef, doRewrite, equals, extractInnerHitBuilders, getName, hashCode, printBoostAndQueryName, queryName, queryName, readQueries, requireValue, rewrite, toFilter, toQueries, toQuery, toXContent, writeQueries, writeTo
buildAsBytes, buildAsBytes, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
rewriteQuery
public static final java.lang.String NAME
public static final ParseField QUERY_NAME_FIELD
public static final GeoExecType DEFAULT_TYPE
public static final boolean DEFAULT_IGNORE_UNMAPPED
public GeoBoundingBoxQueryBuilder(java.lang.String fieldName)
fieldName
- name of index field containing geo coordinates to operate on.public GeoBoundingBoxQueryBuilder(StreamInput in) throws java.io.IOException
java.io.IOException
protected void doWriteTo(StreamOutput out) throws java.io.IOException
doWriteTo
in class AbstractQueryBuilder<GeoBoundingBoxQueryBuilder>
java.io.IOException
public GeoBoundingBoxQueryBuilder setCorners(double top, double left, double bottom, double right)
top
- The top latitudeleft
- The left longitudebottom
- The bottom latituderight
- The right longitudepublic GeoBoundingBoxQueryBuilder setCorners(GeoPoint topLeft, GeoPoint bottomRight)
topLeft
- topLeft point to add.bottomRight
- bottomRight point to add.public GeoBoundingBoxQueryBuilder setCorners(java.lang.String topLeft, java.lang.String bottomRight)
topLeft
- topLeft point to add as geohash.bottomRight
- bottomRight point to add as geohash.public GeoPoint topLeft()
public GeoPoint bottomRight()
public GeoBoundingBoxQueryBuilder setCornersOGC(GeoPoint bottomLeft, GeoPoint topRight)
bottomLeft
- bottom left corner of bounding box.topRight
- top right corner of bounding box.public GeoBoundingBoxQueryBuilder setCornersOGC(java.lang.String bottomLeft, java.lang.String topRight)
bottomLeft
- bottom left corner geohash.topRight
- top right corner geohash.public GeoBoundingBoxQueryBuilder setValidationMethod(GeoValidationMethod method)
public GeoValidationMethod getValidationMethod()
public GeoBoundingBoxQueryBuilder type(GeoExecType type)
public GeoBoundingBoxQueryBuilder type(java.lang.String type)
public GeoExecType type()
public java.lang.String fieldName()
public GeoBoundingBoxQueryBuilder ignoreUnmapped(boolean ignoreUnmapped)
MatchNoDocsQuery
in place of this query) or throw an exception if
the field is unmapped.public boolean ignoreUnmapped()
MatchNoDocsQuery
in place of this query) or throw an exception if
the field is unmapped.public org.apache.lucene.search.Query doToQuery(QueryShardContext context)
doToQuery
in class AbstractQueryBuilder<GeoBoundingBoxQueryBuilder>
protected void doXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
doXContent
in class AbstractQueryBuilder<GeoBoundingBoxQueryBuilder>
java.io.IOException
public static GeoBoundingBoxQueryBuilder fromXContent(QueryParseContext parseContext) throws java.io.IOException
java.io.IOException
protected boolean doEquals(GeoBoundingBoxQueryBuilder other)
AbstractQueryBuilder
QueryBuilder
object of the same type is "equal to" this one.doEquals
in class AbstractQueryBuilder<GeoBoundingBoxQueryBuilder>
protected int doHashCode()
doHashCode
in class AbstractQueryBuilder<GeoBoundingBoxQueryBuilder>
public java.lang.String getWriteableName()
NamedWriteable