public class XYPointField extends Field
Finding all documents within a range at search time is efficient. Multiple values for the same field in one document is allowed.
This field defines static factory methods for common operations:
newBoxQuery() for matching points within a bounding box.
newDistanceQuery() for matching points within a specified distance.
newPolygonQuery() for matching points within an arbitrary polygon.
newGeometryQuery() for matching points within an arbitrary geometry collection.
If you also need per-document operations such as sort by distance, add a separate XYDocValuesField instance.
If you also need to store the value, you should add a separate StoredField instance.
PointValues,
XYDocValuesFieldField.Store| Modifier and Type | Field and Description |
|---|---|
static int |
BYTES
XYPoint is encoded as integer values so number of bytes is 4
|
static FieldType |
TYPE
Type for an indexed XYPoint
|
fieldsData, name, tokenStream, type| Constructor and Description |
|---|
XYPointField(String name,
float x,
float y)
Creates a new XYPoint with the specified x and y
|
| Modifier and Type | Method and Description |
|---|---|
static Query |
newBoxQuery(String field,
float minX,
float maxX,
float minY,
float maxY)
Create a query for matching a bounding box.
|
static Query |
newDistanceQuery(String field,
float x,
float y,
float radius)
Create a query for matching points within the specified distance of the supplied location.
|
static Query |
newGeometryQuery(String field,
XYGeometry... xyGeometries)
create a query to find all indexed shapes that intersect a provided geometry collection.
|
static Query |
newPolygonQuery(String field,
XYPolygon... polygons)
Create a query for matching one or more polygons.
|
void |
setLocationValue(float x,
float y)
Change the values of this field
|
String |
toString()
Prints a Field for human consumption.
|
binaryValue, fieldType, getCharSequenceValue, name, numericValue, readerValue, setBytesValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, stringValue, tokenStream, tokenStreamValuepublic static final int BYTES
public static final FieldType TYPE
Each point stores two dimensions with 4 bytes per dimension.
public XYPointField(String name, float x, float y)
name - field namex - x value.y - y value.public void setLocationValue(float x,
float y)
x - x value.y - y value.public String toString()
Fieldpublic static Query newBoxQuery(String field, float minX, float maxX, float minY, float maxY)
field - field name. must not be null.minX - x lower bound.maxX - x upper bound.minY - y lower bound.maxY - y upper bound.IllegalArgumentException - if field is null, or the box has invalid coordinates.public static Query newDistanceQuery(String field, float x, float y, float radius)
field - field name. must not be null.x - x at the center.y - y at the center.radius - maximum distance from the center in cartesian units: must be non-negative and finite.IllegalArgumentException - if field is null, location has invalid coordinates, or radius is invalid.public static Query newPolygonQuery(String field, XYPolygon... polygons)
field - field name. must not be null.polygons - array of polygons. must not be null or emptyIllegalArgumentException - if field is null, polygons is null or emptyPolygonpublic static Query newGeometryQuery(String field, XYGeometry... xyGeometries)
field - field name. must not be null.xyGeometries - array of geometries. must not be null or empty.IllegalArgumentException - if field is null, polygons is null, empty or contains a null or XYLine geometry.XYGeometryCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.