public class GeoContextMapping extends ContextMapping<GeoQueryContext>
ContextMapping
that uses a geo location/area as a
criteria.
The suggestions can be boosted and/or filtered depending on
whether it falls within an area, represented by a query geo hash
with a specified precision
GeoQueryContext
defines the options for constructing
a unit of query context for this context typeModifier and Type | Class and Description |
---|---|
static class |
GeoContextMapping.Builder |
ContextMapping.InternalQueryContext, ContextMapping.Type
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PRECISION |
static java.lang.String |
FIELD_FIELDNAME |
static java.lang.String |
FIELD_PRECISION |
FIELD_NAME, FIELD_TYPE, name, type
EMPTY_PARAMS
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
protected GeoQueryContext |
fromXContent(QueryParseContext context)
Prototype for the query context
|
java.lang.String |
getFieldName() |
int |
getPrecision() |
int |
hashCode() |
protected static GeoContextMapping |
load(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> config) |
java.util.Set<java.lang.CharSequence> |
parseContext(ParseContext.Document document)
Retrieves a set of context from a
document at index-time. |
java.util.Set<java.lang.CharSequence> |
parseContext(ParseContext parseContext,
XContentParser parser)
Parse a set of
CharSequence contexts at index-time. |
protected XContentBuilder |
toInnerXContent(XContentBuilder builder,
ToXContent.Params params)
Implementations should add specific configurations
that need to be persisted
|
java.util.List<ContextMapping.InternalQueryContext> |
toInternalQueryContexts(java.util.List<GeoQueryContext> queryContexts)
Parse a list of
GeoQueryContext
using parser . |
name, parseQueryContext, toString, toXContent, type
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isFragment
public static final java.lang.String FIELD_PRECISION
public static final java.lang.String FIELD_FIELDNAME
public static final int DEFAULT_PRECISION
public java.lang.String getFieldName()
public int getPrecision()
protected static GeoContextMapping load(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> config)
protected XContentBuilder toInnerXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
ContextMapping
toInnerXContent
in class ContextMapping<GeoQueryContext>
java.io.IOException
public java.util.Set<java.lang.CharSequence> parseContext(ParseContext parseContext, XContentParser parser) throws java.io.IOException, ElasticsearchParseException
CharSequence
contexts at index-time.
Acceptable formats:
[<GEO POINT>, ..]
"GEO POINT"
GeoUtils.parseGeoPoint(String, GeoPoint)
for GEO POINTparseContext
in class ContextMapping<GeoQueryContext>
java.io.IOException
ElasticsearchParseException
public java.util.Set<java.lang.CharSequence> parseContext(ParseContext.Document document)
ContextMapping
document
at index-time.parseContext
in class ContextMapping<GeoQueryContext>
protected GeoQueryContext fromXContent(QueryParseContext context) throws java.io.IOException
ContextMapping
fromXContent
in class ContextMapping<GeoQueryContext>
java.io.IOException
public java.util.List<ContextMapping.InternalQueryContext> toInternalQueryContexts(java.util.List<GeoQueryContext> queryContexts)
GeoQueryContext
using parser
. A QueryContexts accepts one of the following forms:
[GeoQueryContext, ..]
GEO POINT
{"lat": <double>, "lon": <double>, "precision": <int>, "neighbours": <[int, ..]>}
{"context": <string>, "boost": <int>, "precision": <int>, "neighbours": <[int, ..]>}
{"context": <GEO POINT>, "boost": <int>, "precision": <int>, "neighbours": <[int, ..]>}
GEO POINT
GeoUtils.parseGeoPoint(String, GeoPoint)
for GEO POINTtoInternalQueryContexts
in class ContextMapping<GeoQueryContext>
public boolean equals(java.lang.Object o)
equals
in class ContextMapping<GeoQueryContext>
public int hashCode()
hashCode
in class ContextMapping<GeoQueryContext>