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.
Modifier and Type | Class and Description |
---|---|
static class |
GeoPointField.TermEncoding
Expert: Optional flag to select term encoding for GeoPointField types
|
Field.Index, Field.Store, Field.TermVector
Modifier and Type | Field and Description |
---|---|
static FieldType |
NUMERIC_TYPE_NOT_STORED
Deprecated.
Type for a GeoPointField that is not stored:
normalization factors, frequencies, and positions are omitted.
|
static FieldType |
NUMERIC_TYPE_STORED
Deprecated.
Type for a stored GeoPointField:
normalization factors, frequencies, and positions are omitted.
|
static int |
PRECISION_STEP
encoding step value for GeoPoint prefix terms
|
static FieldType |
PREFIX_TYPE_NOT_STORED
Type for a GeoPointField that is not stored:
normalization factors, frequencies, and positions are omitted.
|
static FieldType |
PREFIX_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
|
GeoPointField(String name,
double lon,
double lat,
FieldType type)
Expert: allows you to customize the
FieldType . |
GeoPointField(String name,
double lon,
double lat,
GeoPointField.TermEncoding termEncoding,
Field.Store stored)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
double |
getLat()
access latitude value
|
double |
getLon()
access longitude value
|
TokenStream |
tokenStream(Analyzer analyzer,
TokenStream reuse) |
String |
toString() |
binaryValue, boost, fieldType, name, numericValue, readerValue, setBoost, setBytesValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, stringValue, tokenStreamValue, translateFieldType
public static final int PRECISION_STEP
@Deprecated public static final FieldType NUMERIC_TYPE_NOT_STORED
@Deprecated public static final FieldType NUMERIC_TYPE_STORED
public static final FieldType PREFIX_TYPE_NOT_STORED
public static final FieldType PREFIX_TYPE_STORED
public GeoPointField(String name, double lon, double lat, Field.Store stored)
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.@Deprecated public GeoPointField(String name, double lon, double lat, GeoPointField.TermEncoding termEncoding, Field.Store stored)
GeoPointField.TermEncoding
methodname
- field namelon
- longitude double value [-180.0 : 180.0]lat
- latitude double value [-90.0 : 90.0]termEncoding
- encoding type to use (GeoPointField.TermEncoding.NUMERIC
Terms, or GeoPointField.TermEncoding.PREFIX
only Terms)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()public TokenStream tokenStream(Analyzer analyzer, TokenStream reuse)
tokenStream
in interface IndexableField
tokenStream
in class Field
public double getLon()
public double getLat()
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.