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
public class CategoryContextMapping extends ContextMapping<CategoryQueryContext>
AContextMapping
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 Classes Modifier and Type Class Description static class
CategoryContextMapping.Builder
Builder forCategoryContextMapping
-
Nested classes/interfaces inherited from class org.elasticsearch.search.suggest.completion.context.ContextMapping
ContextMapping.InternalQueryContext, ContextMapping.Type
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.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, type
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
protected CategoryQueryContext
fromXContent(XContentParser parser)
Prototype for the query contextjava.lang.String
getFieldName()
Name of the field to get contexts from at index-timeint
hashCode()
protected static CategoryContextMapping
load(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> config)
Loads aname
dCategoryContextMapping
instance from a map.java.util.Set<java.lang.CharSequence>
parseContext(ParseContext.Document document)
Retrieves a set of context from adocument
at index-time.java.util.Set<java.lang.CharSequence>
parseContext(ParseContext parseContext, XContentParser parser)
Parse a set ofCharSequence
contexts at index-time.protected XContentBuilder
toInnerXContent(XContentBuilder builder, ToXContent.Params params)
Implementations should add specific configurations that need to be persistedjava.util.List<ContextMapping.InternalQueryContext>
toInternalQueryContexts(java.util.List<CategoryQueryContext> queryContexts)
Parse a list ofCategoryQueryContext
usingparser
.-
Methods inherited from class org.elasticsearch.search.suggest.completion.context.ContextMapping
name, parseQueryContext, toString, toXContent, type
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Method Detail
-
getFieldName
public java.lang.String getFieldName()
Name of the field to get contexts from at index-time
-
load
protected static CategoryContextMapping load(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> config) throws ElasticsearchParseException
Loads aname
dCategoryContextMapping
instance from a map. seeContextMappings.load(Object, Version)
Acceptable map param:path
- Throws:
ElasticsearchParseException
-
toInnerXContent
protected XContentBuilder toInnerXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
Description copied from class:ContextMapping
Implementations should add specific configurations that need to be persisted- Specified by:
toInnerXContent
in classContextMapping<CategoryQueryContext>
- Throws:
java.io.IOException
-
parseContext
public java.util.Set<java.lang.CharSequence> parseContext(ParseContext parseContext, XContentParser parser) throws java.io.IOException, ElasticsearchParseException
Parse a set ofCharSequence
contexts at index-time. Acceptable formats:- Array:
[<string>, ..]
- String:
"string"
- Specified by:
parseContext
in classContextMapping<CategoryQueryContext>
- Throws:
java.io.IOException
ElasticsearchParseException
- Array:
-
parseContext
public java.util.Set<java.lang.CharSequence> parseContext(ParseContext.Document document)
Description copied from class:ContextMapping
Retrieves a set of context from adocument
at index-time.- Specified by:
parseContext
in classContextMapping<CategoryQueryContext>
-
fromXContent
protected CategoryQueryContext fromXContent(XContentParser parser) throws java.io.IOException
Description copied from class:ContextMapping
Prototype for the query context- Specified by:
fromXContent
in classContextMapping<CategoryQueryContext>
- Throws:
java.io.IOException
-
toInternalQueryContexts
public java.util.List<ContextMapping.InternalQueryContext> toInternalQueryContexts(java.util.List<CategoryQueryContext> queryContexts)
Parse a list ofCategoryQueryContext
usingparser
. 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:
toInternalQueryContexts
in classContextMapping<CategoryQueryContext>
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classContextMapping<CategoryQueryContext>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classContextMapping<CategoryQueryContext>
-
-