public class ContextMappings extends java.lang.Object implements ToXContent
ContextMapping
s
for a CompletionFieldMapper
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
EMPTY_PARAMS
Constructor and Description |
---|
ContextMappings(java.util.List<ContextMapping> contextMappings) |
Modifier and Type | Method and Description |
---|---|
void |
addField(ParseContext.Document document,
java.lang.String name,
java.lang.String input,
int weight,
java.util.Map<java.lang.String,java.util.Set<java.lang.CharSequence>> contexts)
Adds a context-enabled field for all the defined mappings to
document
see ContextMappings.TypedContextField |
boolean |
equals(java.lang.Object obj) |
ContextMapping |
get(java.lang.String name)
Returns a context mapping by its name
|
java.util.Map<java.lang.String,java.util.Set<java.lang.CharSequence>> |
getNamedContexts(java.util.List<java.lang.CharSequence> contexts)
Maps an output context list to a map of context mapping names and their values
see
ContextMappings.TypedContextField |
int |
hashCode() |
static ContextMappings |
load(java.lang.Object configuration,
Version indexVersionCreated)
Loads
ContextMappings from configuration
Expected configuration:
List of maps representing ContextMapping
[{"name": .., "type": .., ..}, {..}] |
int |
size() |
org.apache.lucene.search.suggest.document.ContextQuery |
toContextQuery(org.apache.lucene.search.suggest.document.CompletionQuery query,
java.util.Map<java.lang.String,java.util.List<ContextMapping.InternalQueryContext>> queryContexts)
Wraps a
CompletionQuery with context queries |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params)
Writes a list of objects specified by the defined
ContextMapping s
see ToXContent.toXContent(XContentBuilder, Params) |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
isFragment
public ContextMappings(java.util.List<ContextMapping> contextMappings)
public int size()
public ContextMapping get(java.lang.String name)
public void addField(ParseContext.Document document, java.lang.String name, java.lang.String input, int weight, java.util.Map<java.lang.String,java.util.Set<java.lang.CharSequence>> contexts)
document
see ContextMappings.TypedContextField
public org.apache.lucene.search.suggest.document.ContextQuery toContextQuery(org.apache.lucene.search.suggest.document.CompletionQuery query, java.util.Map<java.lang.String,java.util.List<ContextMapping.InternalQueryContext>> queryContexts)
CompletionQuery
with context queriesquery
- base completion query to wrapqueryContexts
- a map of context mapping name and collected query contextspublic java.util.Map<java.lang.String,java.util.Set<java.lang.CharSequence>> getNamedContexts(java.util.List<java.lang.CharSequence> contexts)
ContextMappings.TypedContextField
public static ContextMappings load(java.lang.Object configuration, Version indexVersionCreated) throws ElasticsearchParseException
ContextMappings
from configuration
Expected configuration:
List of maps representing ContextMapping
[{"name": .., "type": .., ..}, {..}]ElasticsearchParseException
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
ContextMapping
s
see ToXContent.toXContent(XContentBuilder, Params)
toXContent
in interface ToXContent
java.io.IOException
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object