public class CategoryContextMapping extends ContextMapping
CategoryContextMapping
is used to define a ContextMapping
that
references a field within a document. The value of the field in turn will be
used to setup the suggestions made by the completion suggester.Modifier and Type | Class and Description |
---|---|
static class |
CategoryContextMapping.Builder |
ContextMapping.Context, ContextMapping.ContextConfig, ContextMapping.ContextQuery
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
TYPE |
EMPTY_CONFIG, EMPTY_CONTEXT, EMPTY_MAPPING, FIELD_MISSING, FIELD_TYPE, FIELD_VALUE, name, SEPARATOR, type
EMPTY_PARAMS
Constructor and Description |
---|
CategoryContextMapping(java.lang.String name)
Create a new
CategoryContextMapping with the default field
[_type] |
CategoryContextMapping(java.lang.String name,
java.lang.Iterable<java.lang.String> defaultValues)
Create a new
CategoryContextMapping with the default field
[_type] |
CategoryContextMapping(java.lang.String name,
java.lang.String fieldName)
Create a new
CategoryContextMapping with the default field
[_type] |
CategoryContextMapping(java.lang.String name,
java.lang.String fieldName,
java.lang.Iterable<java.lang.String> defaultValues)
Create a new
CategoryContextMapping with the default field
[_type] |
Modifier and Type | Method and Description |
---|---|
org.elasticsearch.search.suggest.completion2x.context.CategoryContextMapping.FieldConfig |
defaultConfig() |
boolean |
equals(java.lang.Object obj) |
java.lang.Iterable<? extends java.lang.CharSequence> |
getDefaultValues() |
java.lang.String |
getFieldName()
Name of the field used by this
CategoryContextMapping |
int |
hashCode() |
protected static CategoryContextMapping |
load(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> config)
Load the specification of a
CategoryContextMapping |
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. |
org.elasticsearch.search.suggest.completion2x.context.CategoryContextMapping.FieldQuery |
parseQuery(java.lang.String name,
XContentParser parser)
Parse a query according to the context.
|
static org.elasticsearch.search.suggest.completion2x.context.CategoryContextMapping.FieldQuery |
query(java.lang.String name,
java.lang.CharSequence... fieldvalues) |
static org.elasticsearch.search.suggest.completion2x.context.CategoryContextMapping.FieldQuery |
query(java.lang.String name,
java.lang.Iterable<? extends java.lang.CharSequence> fieldvalues) |
protected 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
|
mappingsAreEqual, name, toString, toXContent, type
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isFragment
protected static final java.lang.String TYPE
public CategoryContextMapping(java.lang.String name)
CategoryContextMapping
with the default field
[_type]
public CategoryContextMapping(java.lang.String name, java.lang.String fieldName)
CategoryContextMapping
with the default field
[_type]
public CategoryContextMapping(java.lang.String name, java.lang.Iterable<java.lang.String> defaultValues)
CategoryContextMapping
with the default field
[_type]
public CategoryContextMapping(java.lang.String name, java.lang.String fieldName, java.lang.Iterable<java.lang.String> defaultValues)
CategoryContextMapping
with the default field
[_type]
public java.lang.String getFieldName()
CategoryContextMapping
public java.lang.Iterable<? extends java.lang.CharSequence> getDefaultValues()
public org.elasticsearch.search.suggest.completion2x.context.CategoryContextMapping.FieldConfig defaultConfig()
defaultConfig
in class ContextMapping
protected static CategoryContextMapping load(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> config) throws ElasticsearchParseException
CategoryContextMapping
name
- name of the field to use. If null
default field
will be usedCategoryContextMapping
ElasticsearchParseException
protected XContentBuilder toInnerXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
ContextMapping
toInnerXContent
in class ContextMapping
builder
- builder to append the mapping toparams
- parameters passed to the builderjava.io.IOException
public ContextMapping.ContextConfig parseContext(ParseContext parseContext, XContentParser parser) throws java.io.IOException, ElasticsearchParseException
ContextMapping
ContextMapping
combined with the information provided by a document
form a ContextMapping.ContextConfig
which is used to build the underlying FST.parseContext
in class ContextMapping
parseContext
- context of parsing phaseparser
- XContentParser
used to read and setup the configurationContextMapping.ContextConfig
related to this mappingjava.io.IOException
ElasticsearchParseException
public org.elasticsearch.search.suggest.completion2x.context.CategoryContextMapping.FieldQuery parseQuery(java.lang.String name, XContentParser parser) throws java.io.IOException, ElasticsearchParseException
ContextMapping
parseQuery
in class ContextMapping
name
- name of the contextparser
- XContentParser
providing the data of the queryContextMapping.ContextQuery
according to this mappingjava.io.IOException
ElasticsearchParseException
public static org.elasticsearch.search.suggest.completion2x.context.CategoryContextMapping.FieldQuery query(java.lang.String name, java.lang.CharSequence... fieldvalues)
public static org.elasticsearch.search.suggest.completion2x.context.CategoryContextMapping.FieldQuery query(java.lang.String name, java.lang.Iterable<? extends java.lang.CharSequence> fieldvalues)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object