public class Geo3DDocValuesField extends Field
Sorting by distance is efficient. Multiple values for the same field in one document is allowed.
This field defines static factory methods for common operations:
If you also need query operations, you should add a separate Geo3DPoint
instance.
WARNING: Values are indexed with some loss of precision from the
original double
values (4.190951585769653E-8 for the latitude component
and 8.381903171539307E-8 for longitude).
Geo3DPoint
Field.Store
Modifier and Type | Field and Description |
---|---|
static FieldType |
TYPE
Type for a Geo3DDocValuesField
|
fieldsData, name, tokenStream, type
Constructor and Description |
---|
Geo3DDocValuesField(String name,
double x,
double y,
double z,
PlanetModel planetModel)
Creates a new Geo3DDocValuesField with the specified x, y, and z
|
Geo3DDocValuesField(String name,
GeoPoint point,
PlanetModel planetModel)
Creates a new Geo3DDocValuesField with the specified x, y, and z
|
Modifier and Type | Method and Description |
---|---|
static SortField |
newDistanceSort(String field,
double latitude,
double longitude,
double maxRadiusMeters,
PlanetModel planetModel)
Creates a SortField for sorting by distance within a circle.
|
static SortField |
newOutsideBoxSort(String field,
double minLatitude,
double maxLatitude,
double minLongitude,
double maxLongitude,
PlanetModel planetModel)
Creates a SortField for sorting by outside distance from a box.
|
static SortField |
newOutsideDistanceSort(String field,
double latitude,
double longitude,
double maxRadiusMeters,
PlanetModel planetModel)
Creates a SortField for sorting by outside distance from a circle.
|
static SortField |
newOutsideLargePolygonSort(String field,
PlanetModel planetModel,
Polygon... polygons)
Creates a SortField for sorting by outside distance from a large polygon.
|
static SortField |
newOutsidePathSort(String field,
double[] pathLatitudes,
double[] pathLongitudes,
double pathWidthMeters,
PlanetModel planetModel)
Creates a SortField for sorting by outside distance from a path.
|
static SortField |
newOutsidePolygonSort(String field,
PlanetModel planetModel,
Polygon... polygons)
Creates a SortField for sorting by outside distance from a polygon.
|
static SortField |
newPathSort(String field,
double[] pathLatitudes,
double[] pathLongitudes,
double pathWidthMeters,
PlanetModel planetModel)
Creates a SortField for sorting by distance along a path.
|
void |
setLocationValue(double x,
double y,
double z)
Change the values of this field
|
void |
setLocationValue(GeoPoint point)
Change the values of this field
|
String |
toString() |
binaryValue, fieldType, getCharSequenceValue, name, numericValue, readerValue, setBytesValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, stringValue, tokenStream, tokenStreamValue
public static final FieldType TYPE
Each value stores a 64-bit long where the three values (x, y, and z) are given 21 bits each. Each 21-bit value represents the maximum extent in that dimension for the defined planet model.
public Geo3DDocValuesField(String name, GeoPoint point, PlanetModel planetModel)
name
- field namepoint
- is the point.IllegalArgumentException
- if the field name is null or the point is out of boundspublic Geo3DDocValuesField(String name, double x, double y, double z, PlanetModel planetModel)
name
- field namex
- is the x value for the point.y
- is the y value for the point.z
- is the z value for the point.IllegalArgumentException
- if the field name is null or x, y, or z are out of boundspublic void setLocationValue(GeoPoint point)
point
- is the point.IllegalArgumentException
- if the point is out of boundspublic void setLocationValue(double x, double y, double z)
x
- is the x value for the point.y
- is the y value for the point.z
- is the z value for the point.IllegalArgumentException
- if x, y, or z are out of boundspublic static SortField newDistanceSort(String field, double latitude, double longitude, double maxRadiusMeters, PlanetModel planetModel)
This sort orders documents by ascending distance from the location. The value returned in FieldDoc
for
the hits contains a Double instance with the distance in meters.
If a document is missing the field, then by default it is treated as having Double.POSITIVE_INFINITY
distance
(missing values sort last).
If a document contains multiple values for the field, the closest distance from the circle center is used.
field
- field name. must not be null.latitude
- latitude at the center: must be within standard +/-90 coordinate bounds.longitude
- longitude at the center: must be within standard +/-180 coordinate bounds.maxRadiusMeters
- is the maximum radius in meters.IllegalArgumentException
- if field
is null or circle has invalid coordinates.public static SortField newPathSort(String field, double[] pathLatitudes, double[] pathLongitudes, double pathWidthMeters, PlanetModel planetModel)
This sort orders documents by ascending distance along the described path. The value returned in FieldDoc
for
the hits contains a Double instance with the distance in meters.
If a document is missing the field, then by default it is treated as having Double.POSITIVE_INFINITY
distance
(missing values sort last).
If a document contains multiple values for the field, the closest distance along the path is used.
field
- field name. must not be null.pathLatitudes
- latitude values for points of the path: must be within standard +/-90 coordinate bounds.pathLongitudes
- longitude values for points of the path: must be within standard +/-180 coordinate bounds.pathWidthMeters
- width of the path in meters.IllegalArgumentException
- if field
is null or path has invalid coordinates.public static SortField newOutsideDistanceSort(String field, double latitude, double longitude, double maxRadiusMeters, PlanetModel planetModel)
This sort orders documents by ascending outside distance from the circle. Points within the circle have distance 0.0.
The value returned in FieldDoc
for
the hits contains a Double instance with the distance in meters.
If a document is missing the field, then by default it is treated as having Double.POSITIVE_INFINITY
distance
(missing values sort last).
If a document contains multiple values for the field, the closest distance to the circle is used.
field
- field name. must not be null.latitude
- latitude at the center: must be within standard +/-90 coordinate bounds.longitude
- longitude at the center: must be within standard +/-180 coordinate bounds.maxRadiusMeters
- is the maximum radius in meters.IllegalArgumentException
- if field
is null or location has invalid coordinates.public static SortField newOutsideBoxSort(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude, PlanetModel planetModel)
This sort orders documents by ascending outside distance from the box. Points within the box have distance 0.0.
The value returned in FieldDoc
for
the hits contains a Double instance with the distance in meters.
If a document is missing the field, then by default it is treated as having Double.POSITIVE_INFINITY
distance
(missing values sort last).
If a document contains multiple values for the field, the closest distance to the box is used.
field
- field name. must not be null.minLatitude
- latitude lower bound: must be within standard +/-90 coordinate bounds.maxLatitude
- latitude upper bound: must be within standard +/-90 coordinate bounds.minLongitude
- longitude lower bound: must be within standard +/-180 coordinate bounds.maxLongitude
- longitude upper bound: must be within standard +/-180 coordinate bounds.IllegalArgumentException
- if field
is null or box has invalid coordinates.public static SortField newOutsidePolygonSort(String field, PlanetModel planetModel, Polygon... polygons)
This sort orders documents by ascending outside distance from the polygon. Points within the polygon have distance 0.0.
The value returned in FieldDoc
for
the hits contains a Double instance with the distance in meters.
If a document is missing the field, then by default it is treated as having Double.POSITIVE_INFINITY
distance
(missing values sort last).
If a document contains multiple values for the field, the closest distance to the polygon is used.
field
- field name. must not be null.polygons
- is the list of polygons to use to construct the query; must be at least one.IllegalArgumentException
- if field
is null or polygon has invalid coordinates.public static SortField newOutsideLargePolygonSort(String field, PlanetModel planetModel, Polygon... polygons)
This sort orders documents by ascending outside distance from the polygon. Points within the polygon have distance 0.0.
The value returned in FieldDoc
for
the hits contains a Double instance with the distance in meters.
If a document is missing the field, then by default it is treated as having Double.POSITIVE_INFINITY
distance
(missing values sort last).
If a document contains multiple values for the field, the closest distance to the polygon is used.
field
- field name. must not be null.polygons
- is the list of polygons to use to construct the query; must be at least one.IllegalArgumentException
- if field
is null or polygon has invalid coordinates.public static SortField newOutsidePathSort(String field, double[] pathLatitudes, double[] pathLongitudes, double pathWidthMeters, PlanetModel planetModel)
This sort orders documents by ascending outside distance from the described path. Points within the path
are given the distance of 0.0. The value returned in FieldDoc
for
the hits contains a Double instance with the distance in meters.
If a document is missing the field, then by default it is treated as having Double.POSITIVE_INFINITY
distance
(missing values sort last).
If a document contains multiple values for the field, the closest distance from the path is used.
field
- field name. must not be null.pathLatitudes
- latitude values for points of the path: must be within standard +/-90 coordinate bounds.pathLongitudes
- longitude values for points of the path: must be within standard +/-180 coordinate bounds.pathWidthMeters
- width of the path in meters.IllegalArgumentException
- if field
is null or path has invalid coordinates.Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.