public class CategoryContextMapping extends ContextMapping<CategoryQueryContext>
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 typeModifier and Type | Class and Description |
---|---|
static class |
CategoryContextMapping.Builder
Builder for
CategoryContextMapping |
ContextMapping.InternalQueryContext, ContextMapping.Type
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
FIELD_NAME, FIELD_TYPE, name, type
EMPTY_PARAMS
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
protected CategoryQueryContext |
fromXContent(XContentParser parser)
Prototype for the query context
|
java.lang.String |
getFieldName()
Name of the field to get contexts from at index-time
|
int |
hashCode() |
protected static CategoryContextMapping |
load(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> config)
Loads a
name d CategoryContextMapping instance
from a map. |
java.util.Set<java.lang.CharSequence> |
parseContext(ParseContext.Document document)
Retrieves a set of context from a
document at index-time. |
java.util.Set<java.lang.CharSequence> |
parseContext(ParseContext parseContext,
XContentParser parser)
Parse a set of
CharSequence contexts at index-time. |
protected XContentBuilder |
toInnerXContent(XContentBuilder builder,
ToXContent.Params params)
Implementations should add specific configurations
that need to be persisted
|
java.util.List<ContextMapping.InternalQueryContext> |
toInternalQueryContexts(java.util.List<CategoryQueryContext> queryContexts)
Parse a list of
CategoryQueryContext
using parser . |
name, parseQueryContext, toString, toXContent, type
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isFragment
public java.lang.String getFieldName()
protected static CategoryContextMapping load(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> config) throws ElasticsearchParseException
name
d CategoryContextMapping
instance
from a map.
see ContextMappings.load(Object, Version)
Acceptable map param: path
ElasticsearchParseException
protected XContentBuilder toInnerXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
ContextMapping
toInnerXContent
in class ContextMapping<CategoryQueryContext>
java.io.IOException
public java.util.Set<java.lang.CharSequence> parseContext(ParseContext parseContext, XContentParser parser) throws java.io.IOException, ElasticsearchParseException
CharSequence
contexts at index-time.
Acceptable formats:
[<string>, ..]
"string"
parseContext
in class ContextMapping<CategoryQueryContext>
java.io.IOException
ElasticsearchParseException
public java.util.Set<java.lang.CharSequence> parseContext(ParseContext.Document document)
ContextMapping
document
at index-time.parseContext
in class ContextMapping<CategoryQueryContext>
protected CategoryQueryContext fromXContent(XContentParser parser) throws java.io.IOException
ContextMapping
fromXContent
in class ContextMapping<CategoryQueryContext>
java.io.IOException
public java.util.List<ContextMapping.InternalQueryContext> toInternalQueryContexts(java.util.List<CategoryQueryContext> queryContexts)
CategoryQueryContext
using parser
. A QueryContexts accepts one of the following forms:
[CategoryQueryContext, ..]
{"context": <string>, "boost": <int>, "prefix": <boolean>}
"string"
toInternalQueryContexts
in class ContextMapping<CategoryQueryContext>
public boolean equals(java.lang.Object o)
equals
in class ContextMapping<CategoryQueryContext>
public int hashCode()
hashCode
in class ContextMapping<CategoryQueryContext>