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

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

public abstract class AbstractFieldMapper<T>
extends java.lang.Object
implements FieldMapper<T>, XContentMapper


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.xcontent.XContentMapper
XContentMapper.BuilderContext, XContentMapper.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  FieldMapper.Names names
           
protected  boolean omitNorms
           
protected  boolean omitTermFreqAndPositions
           
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.xcontent.XContentMapper
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, boolean omitTermFreqAndPositions, NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer)
           
 
Method Summary
 boolean analyzed()
           
 float boost()
           
protected abstract  java.lang.String contentType()
           
protected  void doXContentBody(XContentBuilder builder)
           
 FieldDataType fieldDataType()
           
 org.apache.lucene.search.Filter fieldFilter(java.lang.String value)
           
 org.apache.lucene.search.Query fieldQuery(java.lang.String value)
          A field query for the specified value.
 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()
           
 java.lang.String indexedValue(java.lang.String value)
          Returns the indexed value.
 void merge(XContentMapper mergeWith, MergeContext mergeContext)
           
 java.lang.String name()
           
 FieldMapper.Names names()
           
 boolean omitNorms()
           
 boolean omitTermFreqAndPositions()
           
 void parse(ParseContext context)
           
protected abstract  org.apache.lucene.document.Fieldable parseCreateField(ParseContext 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(java.lang.String lowerTerm, java.lang.String upperTerm, boolean includeLower, boolean includeUpper)
          Constructs a range query filter based on the mapper.
 org.apache.lucene.search.Query rangeQuery(java.lang.String lowerTerm, java.lang.String upperTerm, boolean includeLower, boolean includeUpper)
          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.document.Field.Store store()
           
 boolean stored()
           
 org.apache.lucene.document.Field.TermVector termVector()
           
 void toXContent(XContentBuilder builder, ToXContent.Params params)
           
 void traverse(FieldMapperListener fieldMapperListener)
           
 boolean useFieldQueryWithQueryString()
          Should the field query FieldMapper.fieldQuery(String) be used when detecting this field in query string.
 java.lang.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 boolean omitNorms

omitTermFreqAndPositions

protected boolean omitTermFreqAndPositions

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,
                              boolean omitTermFreqAndPositions,
                              NamedAnalyzer indexAnalyzer,
                              NamedAnalyzer searchAnalyzer)
Method Detail

name

public java.lang.String name()
Specified by:
name in interface XContentMapper

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>

omitTermFreqAndPositions

public boolean omitTermFreqAndPositions()
Specified by:
omitTermFreqAndPositions 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>

parse

public void parse(ParseContext context)
           throws java.io.IOException
Specified by:
parse in interface XContentMapper
Throws:
java.io.IOException

parseCreateField

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

traverse

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

valueForSearch

public java.lang.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 java.lang.String indexedValue(java.lang.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) be used when detecting this field in query string.

Specified by:
useFieldQueryWithQueryString in interface FieldMapper<T>

fieldQuery

public org.apache.lucene.search.Query fieldQuery(java.lang.String value)
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(java.lang.String value)
Specified by:
fieldFilter in interface FieldMapper<T>

rangeQuery

public org.apache.lucene.search.Query rangeQuery(java.lang.String lowerTerm,
                                                 java.lang.String upperTerm,
                                                 boolean includeLower,
                                                 boolean includeUpper)
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(java.lang.String lowerTerm,
                                                   java.lang.String upperTerm,
                                                   boolean includeLower,
                                                   boolean includeUpper)
Description copied from interface: FieldMapper
Constructs a range query filter based on the mapper.

Specified by:
rangeFilter in interface FieldMapper<T>

merge

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

fieldDataType

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

toXContent

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

doXContentBody

protected void doXContentBody(XContentBuilder builder)
                       throws java.io.IOException
Throws:
java.io.IOException

contentType

protected abstract java.lang.String contentType()