public final class GeoPointField extends Field
Field that indexes latitude
longitude
decimal-degree values
for efficient encoding, sorting, and querying. This Geo capability is intended
to provide a basic and efficient out of the box field type for indexing and
querying 2 dimensional points in WGS-84 decimal degrees. An example usage is as follows:
document.add(new GeoPointField(name, -96.33, 32.66, Field.Store.NO));
To perform simple geospatial queries against a GeoPointField
,
see GeoPointInBBoxQuery
, GeoPointInPolygonQuery
,
or GeoPointDistanceQuery
NOTE: This indexes only high precision encoded terms which may result in visiting a high number
of terms for large queries. See LUCENE-6481 for a future improvement.
Field.Index, Field.Store, Field.TermVector
Modifier and Type | Field and Description |
---|---|
static int |
PRECISION_STEP |
static FieldType |
TYPE_NOT_STORED
Type for an GeoPointField that is not stored:
normalization factors, frequencies, and positions are omitted.
|
static FieldType |
TYPE_STORED
Type for a stored GeoPointField:
normalization factors, frequencies, and positions are omitted.
|
boost, fieldsData, name, tokenStream, type
Constructor and Description |
---|
GeoPointField(String name,
double lon,
double lat,
Field.Store stored)
Creates a stored or un-stored GeoPointField with the provided value
and default
precisionStep set to 64 to avoid wasteful
indexing of lower precision terms. |
GeoPointField(String name,
double lon,
double lat,
FieldType type)
Expert: allows you to customize the
FieldType . |
Modifier and Type | Method and Description |
---|---|
double |
getLat() |
double |
getLon() |
String |
toString() |
binaryValue, boost, fieldType, name, numericValue, readerValue, setBoost, setBytesValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, stringValue, tokenStream, tokenStreamValue, translateFieldType
public static final int PRECISION_STEP
public static final FieldType TYPE_NOT_STORED
public static final FieldType TYPE_STORED
public GeoPointField(String name, double lon, double lat, Field.Store stored)
precisionStep
set to 64 to avoid wasteful
indexing of lower precision terms.name
- field namelon
- longitude double value [-180.0 : 180.0]lat
- latitude double value [-90.0 : 90.0]stored
- Store.YES if the content should also be storedIllegalArgumentException
- if the field name is null.public GeoPointField(String name, double lon, double lat, FieldType type)
FieldType
.name
- field namelon
- longitude double value [-180.0 : 180.0]lat
- latitude double value [-90.0 : 90.0]type
- customized field type: must have FieldType.numericType()
of FieldType.NumericType.LONG
.IllegalArgumentException
- if the field name or type is null, or
if the field type does not have a LONG numericType()Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.