org.elasticsearch.index.mapper.xcontent
Class XContentDateFieldMapper

java.lang.Object
  extended by org.elasticsearch.index.mapper.xcontent.XContentFieldMapper<T>
      extended by org.elasticsearch.index.mapper.xcontent.XContentNumberFieldMapper<java.lang.Long>
          extended by org.elasticsearch.index.mapper.xcontent.XContentDateFieldMapper
All Implemented Interfaces:
FieldMapper<java.lang.Long>, XContentIncludeInAllMapper, XContentMapper, ToXContent

public class XContentDateFieldMapper
extends XContentNumberFieldMapper<java.lang.Long>


Nested Class Summary
static class XContentDateFieldMapper.Builder
           
static class XContentDateFieldMapper.Defaults
           
static class XContentDateFieldMapper.TypeParser
           
 
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.xcontent.XContentNumberFieldMapper
XContentNumberFieldMapper.CachedNumericTokenStream
 
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.xcontent.XContentFieldMapper
XContentFieldMapper.OpenBuilder<T extends XContentFieldMapper.Builder,Y extends XContentFieldMapper>
 
Nested classes/interfaces inherited from interface org.elasticsearch.index.mapper.xcontent.XContentMapper
XContentMapper.BuilderContext
 
Nested classes/interfaces inherited from interface org.elasticsearch.util.xcontent.ToXContent
ToXContent.MapParams, ToXContent.Params
 
Nested classes/interfaces inherited from interface org.elasticsearch.index.mapper.FieldMapper
FieldMapper.Names
 
Field Summary
static java.lang.String CONTENT_TYPE
           
 
Fields inherited from class org.elasticsearch.index.mapper.xcontent.XContentNumberFieldMapper
includeInAll, precisionStep
 
Fields inherited from class org.elasticsearch.index.mapper.xcontent.XContentFieldMapper
boost, index, indexAnalyzer, names, omitNorms, omitTermFreqAndPositions, searchAnalyzer, store, termVector
 
Fields inherited from interface org.elasticsearch.index.mapper.xcontent.XContentMapper
EMPTY_ARRAY
 
Fields inherited from interface org.elasticsearch.util.xcontent.ToXContent
EMPTY_PARAMS
 
Constructor Summary
protected XContentDateFieldMapper(FieldMapper.Names names, FormatDateTimeFormatter dateTimeFormatter, int precisionStep, org.apache.lucene.document.Field.Index index, org.apache.lucene.document.Field.Store store, float boost, boolean omitNorms, boolean omitTermFreqAndPositions, java.lang.String nullValue)
           
 
Method Summary
protected  java.lang.String contentType()
           
protected  void doXContentBody(XContentBuilder builder)
           
 java.lang.String indexedValue(java.lang.Long value)
          Returns the indexed value.
 java.lang.String indexedValue(java.lang.String value)
          Returns the indexed value.
protected  int maxPrecisionStep()
           
protected  org.apache.lucene.document.Field parseCreateField(ParseContext context)
           
 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.
 int sortType()
           
 java.lang.Long value(org.apache.lucene.document.Fieldable field)
          Returns the actual value of the field.
 java.lang.String valueAsString(org.apache.lucene.document.Fieldable field)
          Returns the actual value of the field as string.
 java.lang.Object valueForSearch(org.apache.lucene.document.Fieldable field)
          Dates should return as a string, delegates to valueAsString(org.apache.lucene.document.Fieldable).
 java.lang.Object valueForSearch(java.lang.Object value)
          Returns the value that will be returned to the user (similar to FieldMapper.valueForSearch(org.apache.lucene.document.Fieldable)).
 java.lang.Object valueFromString(java.lang.String text)
          Parses a string that represents the field into its value.
 java.lang.Object valueFromTerm(java.lang.String term)
          Simply returns the same string.
 
Methods inherited from class org.elasticsearch.index.mapper.xcontent.XContentNumberFieldMapper
fieldFilter, fieldQuery, includeInAll, popCachedStream, precisionStep, shouldBreakTermEnumeration, useFieldQueryWithQueryString
 
Methods inherited from class org.elasticsearch.index.mapper.xcontent.XContentFieldMapper
analyzed, boost, index, indexAnalyzer, indexed, merge, name, names, omitNorms, omitTermFreqAndPositions, parse, queryStringTermQuery, searchAnalyzer, store, stored, termVector, toXContent, 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.xcontent.XContentMapper
merge, name, parse, traverse
 
Methods inherited from interface org.elasticsearch.util.xcontent.ToXContent
toXContent
 

Field Detail

CONTENT_TYPE

public static final java.lang.String CONTENT_TYPE
See Also:
Constant Field Values
Constructor Detail

XContentDateFieldMapper

protected XContentDateFieldMapper(FieldMapper.Names names,
                                  FormatDateTimeFormatter dateTimeFormatter,
                                  int precisionStep,
                                  org.apache.lucene.document.Field.Index index,
                                  org.apache.lucene.document.Field.Store store,
                                  float boost,
                                  boolean omitNorms,
                                  boolean omitTermFreqAndPositions,
                                  java.lang.String nullValue)
Method Detail

maxPrecisionStep

protected int maxPrecisionStep()
Specified by:
maxPrecisionStep in class XContentNumberFieldMapper<java.lang.Long>

value

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


valueForSearch

public java.lang.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<java.lang.Long>
Overrides:
valueForSearch in class XContentNumberFieldMapper<java.lang.Long>

valueForSearch

public java.lang.Object valueForSearch(java.lang.Object value)
Description copied from interface: FieldMapper
Returns the value that will be returned to the user (similar to FieldMapper.valueForSearch(org.apache.lucene.document.Fieldable)).

Specified by:
valueForSearch in interface FieldMapper<java.lang.Long>
Overrides:
valueForSearch in class XContentFieldMapper<java.lang.Long>

valueAsString

public java.lang.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<java.lang.Long>
Overrides:
valueAsString in class XContentNumberFieldMapper<java.lang.Long>

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<java.lang.Long>
Overrides:
indexedValue in class XContentFieldMapper<java.lang.Long>

indexedValue

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

Specified by:
indexedValue in interface FieldMapper<java.lang.Long>
Overrides:
indexedValue in class XContentFieldMapper<java.lang.Long>

valueFromTerm

public java.lang.Object valueFromTerm(java.lang.String term)
Description copied from class: XContentFieldMapper
Simply returns the same string.

Specified by:
valueFromTerm in interface FieldMapper<java.lang.Long>
Specified by:
valueFromTerm in class XContentNumberFieldMapper<java.lang.Long>

valueFromString

public java.lang.Object valueFromString(java.lang.String text)
Description copied from interface: FieldMapper
Parses a string that represents the field into its value. For example, with numbers, it parses "1" to 1.

Specified by:
valueFromString in interface FieldMapper<java.lang.Long>
Specified by:
valueFromString in class XContentNumberFieldMapper<java.lang.Long>

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<java.lang.Long>
Specified by:
rangeQuery in class XContentNumberFieldMapper<java.lang.Long>

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<java.lang.Long>
Specified by:
rangeFilter in class XContentNumberFieldMapper<java.lang.Long>

parseCreateField

protected org.apache.lucene.document.Field parseCreateField(ParseContext context)
                                                     throws java.io.IOException
Specified by:
parseCreateField in class XContentFieldMapper<java.lang.Long>
Throws:
java.io.IOException

sortType

public int sortType()
Specified by:
sortType in interface FieldMapper<java.lang.Long>
Specified by:
sortType in class XContentNumberFieldMapper<java.lang.Long>

contentType

protected java.lang.String contentType()
Specified by:
contentType in class XContentFieldMapper<java.lang.Long>

doXContentBody

protected void doXContentBody(XContentBuilder builder)
                       throws java.io.IOException
Overrides:
doXContentBody in class XContentNumberFieldMapper<java.lang.Long>
Throws:
java.io.IOException