org.elasticsearch.index.mapper.core
Class DateFieldMapper

java.lang.Object
  extended by org.elasticsearch.index.mapper.core.AbstractFieldMapper<T>
      extended by org.elasticsearch.index.mapper.core.NumberFieldMapper<Long>
          extended by org.elasticsearch.index.mapper.core.DateFieldMapper
All Implemented Interfaces:
ToXContent, FieldMapper<Long>, AllFieldMapper.IncludeInAll, Mapper
Direct Known Subclasses:
TimestampFieldMapper

public class DateFieldMapper
extends NumberFieldMapper<Long>


Nested Class Summary
static class DateFieldMapper.Builder
           
static class DateFieldMapper.Defaults
           
static class DateFieldMapper.TypeParser
           
 
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.core.NumberFieldMapper
NumberFieldMapper.CustomNumericField
 
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.core.AbstractFieldMapper
AbstractFieldMapper.OpenBuilder<T extends AbstractFieldMapper.Builder,Y extends AbstractFieldMapper>
 
Nested classes/interfaces inherited from interface org.elasticsearch.index.mapper.Mapper
Mapper.BuilderContext
 
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.MapParams, ToXContent.Params
 
Nested classes/interfaces inherited from interface org.elasticsearch.index.mapper.FieldMapper
FieldMapper.Names
 
Field Summary
static String CONTENT_TYPE
           
protected  FormatDateTimeFormatter dateTimeFormatter
           
protected  TimeUnit timeUnit
           
 
Fields inherited from class org.elasticsearch.index.mapper.core.NumberFieldMapper
dFuzzyFactor, fuzzyFactor, ignoreMalformed, includeInAll, precisionStep
 
Fields inherited from class org.elasticsearch.index.mapper.core.AbstractFieldMapper
boost, index, indexAnalyzer, indexOptions, names, omitNorms, searchAnalyzer, store, 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 DateFieldMapper(FieldMapper.Names names, FormatDateTimeFormatter dateTimeFormatter, int precisionStep, String fuzzyFactor, org.apache.lucene.document.Field.Index index, org.apache.lucene.document.Field.Store store, float boost, boolean omitNorms, org.apache.lucene.index.FieldInfo.IndexOptions indexOptions, String nullValue, TimeUnit timeUnit, boolean parseUpperInclusive, boolean ignoreMalformed)
           
 
Method Summary
protected  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)
          Numeric field level filter are basically range queries with same value and included.
 org.apache.lucene.search.Query fieldQuery(String value, QueryParseContext context)
          Numeric field level query are basically range queries with same value and included.
 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)
           
 String indexedValue(String value)
          Returns the indexed value.
protected  org.apache.lucene.document.Fieldable innerParseCreateField(ParseContext context)
           
protected  int maxPrecisionStep()
           
 void merge(Mapper mergeWith, MergeContext mergeContext)
           
 org.apache.lucene.search.Filter nullValueFilter()
          Null value filter, returns null if there is no null value associated with the field.
protected  double parseFuzzyFactor(String fuzzyFactor)
           
 org.apache.lucene.search.Filter rangeFilter(FieldDataCache fieldDataCache, String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper, QueryParseContext context)
          A range filter based on the field data cache.
 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.
 Long value(org.apache.lucene.document.Fieldable field)
          Returns the actual value of the field.
 String valueAsString(org.apache.lucene.document.Fieldable field)
          Returns the actual value of the field as string.
 Object valueForSearch(org.apache.lucene.document.Fieldable field)
          Dates should return as a string, delegates to valueAsString(org.apache.lucene.document.Fieldable).
 Long valueFromString(String value)
           
 
Methods inherited from class org.elasticsearch.index.mapper.core.NumberFieldMapper
close, includeInAll, includeInAllIfNotSet, parseCreateField, popCachedStream, precisionStep, useFieldQueryWithQueryString
 
Methods inherited from class org.elasticsearch.index.mapper.core.AbstractFieldMapper
analyzed, boost, index, indexAnalyzer, indexed, indexOptions, indexOptionToString, name, names, omitNorms, parse, prefixFilter, prefixQuery, queryStringTermQuery, searchAnalyzer, searchQuoteAnalyzer, store, stored, termVector, toXContent, traverse, traverse
 
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.Mapper
name, parse, traverse, traverse
 
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContent
toXContent
 

Field Detail

CONTENT_TYPE

public static final String CONTENT_TYPE
See Also:
Constant Field Values

dateTimeFormatter

protected final FormatDateTimeFormatter dateTimeFormatter

timeUnit

protected final TimeUnit timeUnit
Constructor Detail

DateFieldMapper

protected DateFieldMapper(FieldMapper.Names names,
                          FormatDateTimeFormatter dateTimeFormatter,
                          int precisionStep,
                          String fuzzyFactor,
                          org.apache.lucene.document.Field.Index index,
                          org.apache.lucene.document.Field.Store store,
                          float boost,
                          boolean omitNorms,
                          org.apache.lucene.index.FieldInfo.IndexOptions indexOptions,
                          String nullValue,
                          TimeUnit timeUnit,
                          boolean parseUpperInclusive,
                          boolean ignoreMalformed)
Method Detail

parseFuzzyFactor

protected double parseFuzzyFactor(String fuzzyFactor)
Overrides:
parseFuzzyFactor in class NumberFieldMapper<Long>

maxPrecisionStep

protected int maxPrecisionStep()
Specified by:
maxPrecisionStep in class NumberFieldMapper<Long>

value

public Long value(org.apache.lucene.document.Fieldable field)
Description copied from interface: FieldMapper
Returns the actual value of the field.


valueFromString

public Long valueFromString(String value)

valueForSearch

public Object valueForSearch(org.apache.lucene.document.Fieldable field)
Dates should return as a string, delegates to valueAsString(org.apache.lucene.document.Fieldable).

Specified by:
valueForSearch in interface FieldMapper<Long>
Overrides:
valueForSearch in class NumberFieldMapper<Long>

valueAsString

public String valueAsString(org.apache.lucene.document.Fieldable field)
Description copied from interface: FieldMapper
Returns the actual value of the field as string.

Specified by:
valueAsString in interface FieldMapper<Long>
Overrides:
valueAsString in class NumberFieldMapper<Long>

indexedValue

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

Specified by:
indexedValue in interface FieldMapper<Long>
Overrides:
indexedValue in class AbstractFieldMapper<Long>

fuzzyQuery

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

fuzzyQuery

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

fieldQuery

public org.apache.lucene.search.Query fieldQuery(String value,
                                                 @Nullable
                                                 QueryParseContext context)
Description copied from class: NumberFieldMapper
Numeric field level query are basically range queries with same value and included. That's the recommended way to execute it.

Specified by:
fieldQuery in interface FieldMapper<Long>
Overrides:
fieldQuery in class NumberFieldMapper<Long>

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<Long>
Specified by:
rangeQuery in class NumberFieldMapper<Long>

fieldFilter

public org.apache.lucene.search.Filter fieldFilter(String value,
                                                   @Nullable
                                                   QueryParseContext context)
Description copied from class: NumberFieldMapper
Numeric field level filter are basically range queries with same value and included. That's the recommended way to execute it.

Specified by:
fieldFilter in interface FieldMapper<Long>
Overrides:
fieldFilter in class NumberFieldMapper<Long>

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<Long>
Specified by:
rangeFilter in class NumberFieldMapper<Long>

rangeFilter

public org.apache.lucene.search.Filter rangeFilter(FieldDataCache fieldDataCache,
                                                   String lowerTerm,
                                                   String upperTerm,
                                                   boolean includeLower,
                                                   boolean includeUpper,
                                                   @Nullable
                                                   QueryParseContext context)
Description copied from class: NumberFieldMapper
A range filter based on the field data cache.

Specified by:
rangeFilter in class NumberFieldMapper<Long>

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<Long>
Overrides:
nullValueFilter in class AbstractFieldMapper<Long>

customBoost

protected boolean customBoost()
Description copied from class: AbstractFieldMapper
Derived classes can override it to specify that boost value is set by derived classes.

Overrides:
customBoost in class AbstractFieldMapper<Long>

innerParseCreateField

protected org.apache.lucene.document.Fieldable innerParseCreateField(ParseContext context)
                                                              throws IOException
Specified by:
innerParseCreateField in class NumberFieldMapper<Long>
Throws:
IOException

fieldDataType

public FieldDataType fieldDataType()
Specified by:
fieldDataType in interface FieldMapper<Long>
Specified by:
fieldDataType in class NumberFieldMapper<Long>

contentType

protected String contentType()
Specified by:
contentType in class AbstractFieldMapper<Long>

merge

public void merge(Mapper mergeWith,
                  MergeContext mergeContext)
           throws MergeMappingException
Specified by:
merge in interface Mapper
Overrides:
merge in class NumberFieldMapper<Long>
Throws:
MergeMappingException

doXContentBody

protected void doXContentBody(XContentBuilder builder)
                       throws IOException
Overrides:
doXContentBody in class NumberFieldMapper<Long>
Throws:
IOException


Copyright © 2009-2012. All Rights Reserved.