public abstract class ContextMapping extends java.lang.Object implements ToXContent
ContextMapping
is used t define a context that may used
in conjunction with a suggester. To define a suggester that depends on a
specific context derived class of ContextMapping
will be
used to specify the kind of additional information required in order to make
suggestions.Modifier and Type | Class and Description |
---|---|
static class |
ContextMapping.Context
A collection of
ContextMapping s, their ContextMapping.ContextConfig uration and a
Document form a complete ContextMapping.Context . |
static class |
ContextMapping.ContextConfig
A
ContextMapping combined with the information provided by a document
form a ContextMapping.ContextConfig which is used to build the underlying FST . |
static class |
ContextMapping.ContextQuery
A
ContextMapping.ContextQuery defines the context information for a specific ContextMapping
defined within a suggestion request. |
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
static java.util.SortedMap<java.lang.String,ContextMapping.ContextConfig> |
EMPTY_CONFIG
Dummy Context Config matching the Dummy Mapping by providing an empty context
|
static ContextMapping.Context |
EMPTY_CONTEXT
Dummy Context matching the Dummy Mapping by not wrapping a
TokenStream |
static java.util.SortedMap<java.lang.String,ContextMapping> |
EMPTY_MAPPING
Dummy Context Mapping that should be used if no context is used
|
static java.lang.String |
FIELD_MISSING |
static java.lang.String |
FIELD_TYPE |
static java.lang.String |
FIELD_VALUE |
protected java.lang.String |
name |
static char |
SEPARATOR
Character used to separate several contexts
|
protected java.lang.String |
type |
EMPTY_PARAMS
Modifier | Constructor and Description |
---|---|
protected |
ContextMapping(java.lang.String type,
java.lang.String name)
Define a new context mapping of a specific type
|
Modifier and Type | Method and Description |
---|---|
abstract ContextMapping.ContextConfig |
defaultConfig() |
static boolean |
mappingsAreEqual(java.util.SortedMap<java.lang.String,? extends ContextMapping> thisMappings,
java.util.SortedMap<java.lang.String,? extends ContextMapping> otherMappings)
Test equality of two mapping
|
java.lang.String |
name() |
abstract ContextMapping.ContextConfig |
parseContext(ParseContext parseContext,
XContentParser parser)
A
ContextMapping combined with the information provided by a document
form a ContextMapping.ContextConfig which is used to build the underlying FST. |
abstract ContextMapping.ContextQuery |
parseQuery(java.lang.String name,
XContentParser parser)
Parse a query according to the context.
|
protected abstract XContentBuilder |
toInnerXContent(XContentBuilder builder,
ToXContent.Params params)
Since every context mapping is assumed to have a name given by the field name of an context object, this
method is used to build the value used to serialize the mapping
|
java.lang.String |
toString() |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
protected java.lang.String |
type() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isFragment
public static final char SEPARATOR
public static final java.util.SortedMap<java.lang.String,ContextMapping> EMPTY_MAPPING
public static final java.util.SortedMap<java.lang.String,ContextMapping.ContextConfig> EMPTY_CONFIG
public static final ContextMapping.Context EMPTY_CONTEXT
TokenStream
public static final java.lang.String FIELD_VALUE
public static final java.lang.String FIELD_MISSING
public static final java.lang.String FIELD_TYPE
protected final java.lang.String type
protected final java.lang.String name
protected ContextMapping(java.lang.String type, java.lang.String name)
type
- name of the new context mappingprotected java.lang.String type()
public java.lang.String name()
public final XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
toXContent
in interface ToXContent
java.io.IOException
public abstract ContextMapping.ContextConfig parseContext(ParseContext parseContext, XContentParser parser) throws java.io.IOException, ElasticsearchParseException
ContextMapping
combined with the information provided by a document
form a ContextMapping.ContextConfig
which is used to build the underlying FST.parseContext
- context of parsing phaseparser
- XContentParser
used to read and setup the configurationContextMapping.ContextConfig
related to this mappingjava.io.IOException
ElasticsearchParseException
public abstract ContextMapping.ContextConfig defaultConfig()
public abstract ContextMapping.ContextQuery parseQuery(java.lang.String name, XContentParser parser) throws java.io.IOException, ElasticsearchParseException
name
- name of the contextparser
- XContentParser
providing the data of the queryContextMapping.ContextQuery
according to this mappingjava.io.IOException
ElasticsearchParseException
protected abstract XContentBuilder toInnerXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
builder
- builder to append the mapping toparams
- parameters passed to the builderjava.io.IOException
public static boolean mappingsAreEqual(java.util.SortedMap<java.lang.String,? extends ContextMapping> thisMappings, java.util.SortedMap<java.lang.String,? extends ContextMapping> otherMappings)
thisMappings
- first mappingotherMappings
- second mappingpublic java.lang.String toString()
toString
in class java.lang.Object