org.elasticsearch.index.mapper.core
Class AbstractFieldMapper<T>

java.lang.Object
  extended by org.elasticsearch.index.mapper.core.AbstractFieldMapper<T>
All Implemented Interfaces:
ToXContent, FieldMapper<T>, Mapper
Direct Known Subclasses:
AllFieldMapper, BinaryFieldMapper, BooleanFieldMapper, GeoShapeFieldMapper, IdFieldMapper, IndexFieldMapper, NumberFieldMapper, ParentFieldMapper, RoutingFieldMapper, SourceFieldMapper, StringFieldMapper, TypeFieldMapper, UidFieldMapper

public abstract class AbstractFieldMapper<T>
extends Object
implements FieldMapper<T>, Mapper


Nested Class Summary
static class AbstractFieldMapper.Builder<T extends AbstractFieldMapper.Builder,Y extends AbstractFieldMapper>
           
static class AbstractFieldMapper.Defaults
           
static class AbstractFieldMapper.OpenBuilder<T extends AbstractFieldMapper.Builder,Y extends AbstractFieldMapper>
           
 
Nested classes/interfaces inherited from interface org.elasticsearch.index.mapper.FieldMapper
FieldMapper.Names
 
Nested classes/interfaces inherited from interface org.elasticsearch.index.mapper.Mapper
Mapper.BuilderContext, Mapper.TypeParser
 
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.MapParams, ToXContent.Params
 
Field Summary
protected  float boost
           
protected  org.apache.lucene.document.Field.Index index
           
protected  NamedAnalyzer indexAnalyzer
           
protected  org.apache.lucene.index.FieldInfo.IndexOptions indexOptions
           
protected  FieldMapper.Names names
           
protected  boolean omitNorms
           
protected  NamedAnalyzer searchAnalyzer
           
protected  org.apache.lucene.document.Field.Store store
           
protected  org.apache.lucene.document.Field.TermVector termVector
           
 
Fields inherited from interface org.elasticsearch.index.mapper.Mapper
EMPTY_ARRAY
 
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
 
Constructor Summary
protected AbstractFieldMapper(FieldMapper.Names names, org.apache.lucene.document.Field.Index index, org.apache.lucene.document.Field.Store store, org.apache.lucene.document.Field.TermVector termVector, float boost, boolean omitNorms, org.apache.lucene.index.FieldInfo.IndexOptions indexOptions, NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer)
           
 
Method Summary
 boolean analyzed()
           
 float boost()
           
 void close()
           
protected abstract  String contentType()
           
protected  boolean customBoost()
          Derived classes can override it to specify that boost value is set by derived classes.
protected  void doXContentBody(XContentBuilder builder)
           
 FieldDataType fieldDataType()
           
 org.apache.lucene.search.Filter fieldFilter(String value, QueryParseContext context)
           
 org.apache.lucene.search.Query fieldQuery(String value, QueryParseContext context)
          A field query for the specified value.
 org.apache.lucene.search.Query fuzzyQuery(String value, double minSim, int prefixLength, int maxExpansions)
           
 org.apache.lucene.search.Query fuzzyQuery(String value, String minSim, int prefixLength, int maxExpansions)
           
 org.apache.lucene.document.Field.Index index()
           
 org.apache.lucene.analysis.Analyzer indexAnalyzer()
          The analyzer that will be used to index the field.
 boolean indexed()
           
 String indexedValue(String value)
          Returns the indexed value.
 org.apache.lucene.index.FieldInfo.IndexOptions indexOptions()
           
protected static String indexOptionToString(org.apache.lucene.index.FieldInfo.IndexOptions indexOption)
           
 void merge(Mapper mergeWith, MergeContext mergeContext)
           
 String name()
           
 FieldMapper.Names names()
           
 org.apache.lucene.search.Filter nullValueFilter()
          Null value filter, returns null if there is no null value associated with the field.
 boolean omitNorms()
           
 void parse(ParseContext context)
           
protected abstract  org.apache.lucene.document.Fieldable parseCreateField(ParseContext context)
           
 org.apache.lucene.search.Filter prefixFilter(String value, QueryParseContext context)
           
 org.apache.lucene.search.Query prefixQuery(String value, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, QueryParseContext context)
           
 org.apache.lucene.search.Query queryStringTermQuery(org.apache.lucene.index.Term term)
          A term query to use when parsing a query string.
 org.apache.lucene.search.Filter rangeFilter(String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper, QueryParseContext context)
          Constructs a range query filter based on the mapper.
 org.apache.lucene.search.Query rangeQuery(String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper, QueryParseContext context)
          Constructs a range query based on the mapper.
 org.apache.lucene.analysis.Analyzer searchAnalyzer()
          The analyzer that will be used to search the field.
 org.apache.lucene.analysis.Analyzer searchQuoteAnalyzer()
          The analyzer that will be used for quoted search on the field.
 org.apache.lucene.document.Field.Store store()
           
 boolean stored()
           
 org.apache.lucene.document.Field.TermVector termVector()
           
 XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params)
           
 void traverse(FieldMapperListener fieldMapperListener)
           
 void traverse(ObjectMapperListener objectMapperListener)
           
 boolean useFieldQueryWithQueryString()
          Should the field query FieldMapper.fieldQuery(String, org.elasticsearch.index.query.QueryParseContext) be used when detecting this field in query string.
 Object valueForSearch(org.apache.lucene.document.Fieldable field)
          Returns the value that will be used as a result for search.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.elasticsearch.index.mapper.FieldMapper
value, valueAsString, valueFromString
 

Field Detail

names

protected final FieldMapper.Names names

index

protected final org.apache.lucene.document.Field.Index index

store

protected final org.apache.lucene.document.Field.Store store

termVector

protected final org.apache.lucene.document.Field.TermVector termVector

boost

protected float boost

omitNorms

protected final boolean omitNorms

indexOptions

protected final org.apache.lucene.index.FieldInfo.IndexOptions indexOptions

indexAnalyzer

protected final NamedAnalyzer indexAnalyzer

searchAnalyzer

protected final NamedAnalyzer searchAnalyzer
Constructor Detail

AbstractFieldMapper

protected AbstractFieldMapper(FieldMapper.Names names,
                              org.apache.lucene.document.Field.Index index,
                              org.apache.lucene.document.Field.Store store,
                              org.apache.lucene.document.Field.TermVector termVector,
                              float boost,
                              boolean omitNorms,
                              org.apache.lucene.index.FieldInfo.IndexOptions indexOptions,
                              NamedAnalyzer indexAnalyzer,
                              NamedAnalyzer searchAnalyzer)
Method Detail

name

public String name()
Specified by:
name in interface Mapper

names

public FieldMapper.Names names()
Specified by:
names in interface FieldMapper<T>

index

public org.apache.lucene.document.Field.Index index()
Specified by:
index in interface FieldMapper<T>

store

public org.apache.lucene.document.Field.Store store()
Specified by:
store in interface FieldMapper<T>

stored

public boolean stored()
Specified by:
stored in interface FieldMapper<T>

indexed

public boolean indexed()
Specified by:
indexed in interface FieldMapper<T>

analyzed

public boolean analyzed()
Specified by:
analyzed in interface FieldMapper<T>

termVector

public org.apache.lucene.document.Field.TermVector termVector()
Specified by:
termVector in interface FieldMapper<T>

boost

public float boost()
Specified by:
boost in interface FieldMapper<T>

omitNorms

public boolean omitNorms()
Specified by:
omitNorms in interface FieldMapper<T>

indexOptions

public org.apache.lucene.index.FieldInfo.IndexOptions indexOptions()
Specified by:
indexOptions in interface FieldMapper<T>

indexAnalyzer

public org.apache.lucene.analysis.Analyzer indexAnalyzer()
Description copied from interface: FieldMapper
The analyzer that will be used to index the field.

Specified by:
indexAnalyzer in interface FieldMapper<T>

searchAnalyzer

public org.apache.lucene.analysis.Analyzer searchAnalyzer()
Description copied from interface: FieldMapper
The analyzer that will be used to search the field.

Specified by:
searchAnalyzer in interface FieldMapper<T>

searchQuoteAnalyzer

public org.apache.lucene.analysis.Analyzer searchQuoteAnalyzer()
Description copied from interface: FieldMapper
The analyzer that will be used for quoted search on the field.

Specified by:
searchQuoteAnalyzer in interface FieldMapper<T>

parse

public void parse(ParseContext context)
           throws IOException
Specified by:
parse in interface Mapper
Throws:
IOException

parseCreateField

protected abstract org.apache.lucene.document.Fieldable parseCreateField(ParseContext context)
                                                                  throws IOException
Throws:
IOException

customBoost

protected boolean customBoost()
Derived classes can override it to specify that boost value is set by derived classes.


traverse

public void traverse(FieldMapperListener fieldMapperListener)
Specified by:
traverse in interface Mapper

traverse

public void traverse(ObjectMapperListener objectMapperListener)
Specified by:
traverse in interface Mapper

valueForSearch

public Object valueForSearch(org.apache.lucene.document.Fieldable field)
Description copied from interface: FieldMapper
Returns the value that will be used as a result for search. Can be only of specific types... .

Specified by:
valueForSearch in interface FieldMapper<T>

indexedValue

public String indexedValue(String value)
Description copied from interface: FieldMapper
Returns the indexed value.

Specified by:
indexedValue in interface FieldMapper<T>

queryStringTermQuery

public org.apache.lucene.search.Query queryStringTermQuery(org.apache.lucene.index.Term term)
Description copied from interface: FieldMapper
A term query to use when parsing a query string. Can return null.

Specified by:
queryStringTermQuery in interface FieldMapper<T>

useFieldQueryWithQueryString

public boolean useFieldQueryWithQueryString()
Description copied from interface: FieldMapper
Should the field query FieldMapper.fieldQuery(String, org.elasticsearch.index.query.QueryParseContext) be used when detecting this field in query string.

Specified by:
useFieldQueryWithQueryString in interface FieldMapper<T>

fieldQuery

public org.apache.lucene.search.Query fieldQuery(String value,
                                                 @Nullable
                                                 QueryParseContext context)
Description copied from interface: FieldMapper
A field query for the specified value.

Specified by:
fieldQuery in interface FieldMapper<T>

fieldFilter

public org.apache.lucene.search.Filter fieldFilter(String value,
                                                   @Nullable
                                                   QueryParseContext context)
Specified by:
fieldFilter in interface FieldMapper<T>

fuzzyQuery

public org.apache.lucene.search.Query fuzzyQuery(String value,
                                                 String minSim,
                                                 int prefixLength,
                                                 int maxExpansions)
Specified by:
fuzzyQuery in interface FieldMapper<T>

fuzzyQuery

public org.apache.lucene.search.Query fuzzyQuery(String value,
                                                 double minSim,
                                                 int prefixLength,
                                                 int maxExpansions)
Specified by:
fuzzyQuery in interface FieldMapper<T>

prefixQuery

public org.apache.lucene.search.Query prefixQuery(String value,
                                                  @Nullable
                                                  org.apache.lucene.search.MultiTermQuery.RewriteMethod method,
                                                  @Nullable
                                                  QueryParseContext context)
Specified by:
prefixQuery in interface FieldMapper<T>

prefixFilter

public org.apache.lucene.search.Filter prefixFilter(String value,
                                                    @Nullable
                                                    QueryParseContext context)
Specified by:
prefixFilter in interface FieldMapper<T>

rangeQuery

public org.apache.lucene.search.Query rangeQuery(String lowerTerm,
                                                 String upperTerm,
                                                 boolean includeLower,
                                                 boolean includeUpper,
                                                 @Nullable
                                                 QueryParseContext context)
Description copied from interface: FieldMapper
Constructs a range query based on the mapper.

Specified by:
rangeQuery in interface FieldMapper<T>

rangeFilter

public org.apache.lucene.search.Filter rangeFilter(String lowerTerm,
                                                   String upperTerm,
                                                   boolean includeLower,
                                                   boolean includeUpper,
                                                   @Nullable
                                                   QueryParseContext context)
Description copied from interface: FieldMapper
Constructs a range query filter based on the mapper.

Specified by:
rangeFilter in interface FieldMapper<T>

nullValueFilter

public org.apache.lucene.search.Filter nullValueFilter()
Description copied from interface: FieldMapper
Null value filter, returns null if there is no null value associated with the field.

Specified by:
nullValueFilter in interface FieldMapper<T>

merge

public void merge(Mapper mergeWith,
                  MergeContext mergeContext)
           throws MergeMappingException
Specified by:
merge in interface Mapper
Throws:
MergeMappingException

fieldDataType

public FieldDataType fieldDataType()
Specified by:
fieldDataType in interface FieldMapper<T>

toXContent

public XContentBuilder toXContent(XContentBuilder builder,
                                  ToXContent.Params params)
                           throws IOException
Specified by:
toXContent in interface ToXContent
Throws:
IOException

indexOptionToString

protected static String indexOptionToString(org.apache.lucene.index.FieldInfo.IndexOptions indexOption)

doXContentBody

protected void doXContentBody(XContentBuilder builder)
                       throws IOException
Throws:
IOException

contentType

protected abstract String contentType()

close

public void close()
Specified by:
close in interface Mapper


Copyright © 2009-2012. All Rights Reserved.