public abstract class ContextMapping extends 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
ContextMappings, their ContextMapping.ContextConfiguration 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 SortedMap<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 SortedMap<String,ContextMapping> |
EMPTY_MAPPING
Dummy Context Mapping that should be used if no context is used
|
static String |
FIELD_MISSING |
static String |
FIELD_TYPE |
static String |
FIELD_VALUE |
protected String |
name |
static char |
SEPARATOR
Character used to separate several contexts
|
protected String |
type |
EMPTY_PARAMS| Modifier | Constructor and Description |
|---|---|
protected |
ContextMapping(String type,
String name)
Define a new context mapping of a specific type
|
| Modifier and Type | Method and Description |
|---|---|
abstract ContextMapping.ContextConfig |
defaultConfig() |
static boolean |
mappingsAreEqual(SortedMap<String,? extends ContextMapping> thisMappings,
SortedMap<String,? extends ContextMapping> otherMappings)
Test equality of two mapping
|
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(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
|
String |
toString() |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
protected String |
type() |
public static final char SEPARATOR
public static final SortedMap<String,ContextMapping> EMPTY_MAPPING
public static final SortedMap<String,ContextMapping.ContextConfig> EMPTY_CONFIG
public static final ContextMapping.Context EMPTY_CONTEXT
TokenStreampublic static final String FIELD_VALUE
public static final String FIELD_MISSING
public static final String FIELD_TYPE
protected final String type
protected final String name
protected String type()
public String name()
public final XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
toXContent in interface ToXContentIOExceptionpublic abstract ContextMapping.ContextConfig parseContext(ParseContext parseContext, XContentParser parser) throws 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 mappingIOExceptionElasticsearchParseExceptionpublic abstract ContextMapping.ContextConfig defaultConfig()
public abstract ContextMapping.ContextQuery parseQuery(String name, XContentParser parser) throws IOException, ElasticsearchParseException
name - name of the contextparser - XContentParser providing the data of the queryContextMapping.ContextQuery according to this mappingIOExceptionElasticsearchParseExceptionprotected abstract XContentBuilder toInnerXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
builder - builder to append the mapping toparams - parameters passed to the builderIOExceptionpublic static boolean mappingsAreEqual(SortedMap<String,? extends ContextMapping> thisMappings, SortedMap<String,? extends ContextMapping> otherMappings)
thisMappings - first mappingotherMappings - second mappingCopyright © 2009–2017. All rights reserved.