ToXContent, ToXContentFragmentCategoryContextMapping, GeoContextMappingpublic abstract class ContextMapping<T extends ToXContent> extends java.lang.Object implements ToXContentFragment
ContextMapping defines criteria that can be used to
filter and/or boost suggestions at query time for CompletionFieldMapper.
Implementations have to define how contexts are parsed at query/index time| Modifier and Type | Class | Description |
|---|---|---|
static class |
ContextMapping.InternalQueryContext |
|
static class |
ContextMapping.Type |
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
FIELD_NAME |
|
static java.lang.String |
FIELD_TYPE |
|
protected java.lang.String |
name |
|
protected ContextMapping.Type |
type |
EMPTY_PARAMS| Modifier | Constructor | Description |
|---|---|---|
protected |
ContextMapping(ContextMapping.Type type,
java.lang.String name) |
Define a new context mapping of a specific type
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
equals(java.lang.Object o) |
|
protected abstract T |
fromXContent(XContentParser context) |
Prototype for the query context
|
int |
hashCode() |
|
java.lang.String |
name() |
|
protected abstract java.util.Set<java.lang.CharSequence> |
parseContext(ParseContext.Document document) |
Retrieves a set of context from a
document at index-time. |
abstract java.util.Set<java.lang.CharSequence> |
parseContext(ParseContext parseContext,
XContentParser parser) |
Parses a set of index-time contexts.
|
java.util.List<ContextMapping.InternalQueryContext> |
parseQueryContext(XContentParser parser) |
Parses query contexts for this mapper
|
protected abstract XContentBuilder |
toInnerXContent(XContentBuilder builder,
ToXContent.Params params) |
Implementations should add specific configurations
that need to be persisted
|
protected abstract java.util.List<ContextMapping.InternalQueryContext> |
toInternalQueryContexts(java.util.List<T> queryContexts) |
Convert query contexts to common representation
|
java.lang.String |
toString() |
|
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
|
ContextMapping.Type |
type() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitisFragmentpublic static final java.lang.String FIELD_TYPE
public static final java.lang.String FIELD_NAME
protected final ContextMapping.Type type
protected final java.lang.String name
protected ContextMapping(ContextMapping.Type type, java.lang.String name)
type - type of context mapping, either ContextMapping.Type.CATEGORY or ContextMapping.Type.GEOname - name of context mappingpublic ContextMapping.Type type()
public java.lang.String name()
public abstract java.util.Set<java.lang.CharSequence> parseContext(ParseContext parseContext, XContentParser parser) throws java.io.IOException, ElasticsearchParseException
java.io.IOExceptionElasticsearchParseExceptionprotected abstract java.util.Set<java.lang.CharSequence> parseContext(ParseContext.Document document)
document at index-time.protected abstract T fromXContent(XContentParser context) throws java.io.IOException
java.io.IOExceptionpublic final java.util.List<ContextMapping.InternalQueryContext> parseQueryContext(XContentParser parser) throws java.io.IOException, ElasticsearchParseException
java.io.IOExceptionElasticsearchParseExceptionprotected abstract java.util.List<ContextMapping.InternalQueryContext> toInternalQueryContexts(java.util.List<T> queryContexts)
protected abstract XContentBuilder toInnerXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOExceptionpublic final XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
toXContent in interface ToXContentjava.io.IOExceptionpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object