Module org.elasticsearch.server
Class CategoryContextMapping
java.lang.Object
org.elasticsearch.search.suggest.completion.context.ContextMapping<CategoryQueryContext>
org.elasticsearch.search.suggest.completion.context.CategoryContextMapping
- All Implemented Interfaces:
ToXContent,ToXContentFragment
A
ContextMapping that uses a simple string as a criteria
The suggestions are boosted and/or filtered by their associated
category (string) value.
CategoryQueryContext defines options for constructing
a unit of query context for this context type-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.elasticsearch.search.suggest.completion.context.ContextMapping
ContextMapping.InternalQueryContext, ContextMapping.TypeNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params -
Field Summary
Fields inherited from class org.elasticsearch.search.suggest.completion.context.ContextMapping
FIELD_NAME, FIELD_TYPE, name, typeFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected CategoryQueryContextfromXContent(XContentParser parser) Prototype for the query contextName of the field to get contexts from at index-timeinthashCode()protected static CategoryContextMappingLoads anamedCategoryContextMappinginstance from a map.parseContext(DocumentParserContext documentParserContext, XContentParser parser) Parse a set ofCharSequencecontexts at index-time.parseContext(LuceneDocument document) Retrieves a set of context from adocumentat index-time.protected XContentBuildertoInnerXContent(XContentBuilder builder, ToXContent.Params params) Implementations should add specific configurations that need to be persistedtoInternalQueryContexts(List<CategoryQueryContext> queryContexts) Parse a list ofCategoryQueryContextusingparser.Methods inherited from class org.elasticsearch.search.suggest.completion.context.ContextMapping
name, parseQueryContext, toString, toXContent, type, validateReferencesMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Method Details
-
getFieldName
Name of the field to get contexts from at index-time -
load
protected static CategoryContextMapping load(String name, Map<String, Object> config) throws ElasticsearchParseExceptionLoads anamedCategoryContextMappinginstance from a map. seeContextMappings.load(Object)Acceptable map param:path- Throws:
ElasticsearchParseException
-
toInnerXContent
protected XContentBuilder toInnerXContent(XContentBuilder builder, ToXContent.Params params) throws IOException Description copied from class:ContextMappingImplementations should add specific configurations that need to be persisted- Specified by:
toInnerXContentin classContextMapping<CategoryQueryContext>- Throws:
IOException
-
parseContext
public Set<String> parseContext(DocumentParserContext documentParserContext, XContentParser parser) throws IOException, ElasticsearchParseException Parse a set ofCharSequencecontexts at index-time. Acceptable formats:- Array:
[<string>, ..]
- String:
"string"
- Specified by:
parseContextin classContextMapping<CategoryQueryContext>- Throws:
IOExceptionElasticsearchParseException
- Array:
-
parseContext
Description copied from class:ContextMappingRetrieves a set of context from adocumentat index-time.- Specified by:
parseContextin classContextMapping<CategoryQueryContext>
-
fromXContent
Description copied from class:ContextMappingPrototype for the query context- Specified by:
fromXContentin classContextMapping<CategoryQueryContext>- Throws:
IOException
-
toInternalQueryContexts
public List<ContextMapping.InternalQueryContext> toInternalQueryContexts(List<CategoryQueryContext> queryContexts) Parse a list ofCategoryQueryContextusingparser. A QueryContexts accepts one of the following forms:- Object: CategoryQueryContext
- String: CategoryQueryContext value with prefix=false and boost=1
- Array:
[CategoryQueryContext, ..]
- Object:
{"context": <string>, "boost": <int>, "prefix": <boolean>} - String:
"string"
- Specified by:
toInternalQueryContextsin classContextMapping<CategoryQueryContext>
-
equals
- Overrides:
equalsin classContextMapping<CategoryQueryContext>
-
hashCode
public int hashCode()- Overrides:
hashCodein classContextMapping<CategoryQueryContext>
-