org.elasticsearch.index.mapper.json
Class JsonDateFieldMapper

java.lang.Object
  extended by org.elasticsearch.index.mapper.json.JsonFieldMapper<T>
      extended by org.elasticsearch.index.mapper.json.JsonNumberFieldMapper<java.lang.Long>
          extended by org.elasticsearch.index.mapper.json.JsonDateFieldMapper
All Implemented Interfaces:
FieldMapper<java.lang.Long>, JsonIncludeInAllMapper, JsonMapper, ToJson

public class JsonDateFieldMapper
extends JsonNumberFieldMapper<java.lang.Long>


Nested Class Summary
static class JsonDateFieldMapper.Builder
           
static class JsonDateFieldMapper.Defaults
           
static class JsonDateFieldMapper.TypeParser
           
 
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.json.JsonNumberFieldMapper
JsonNumberFieldMapper.CachedNumericTokenStream
 
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.json.JsonFieldMapper
JsonFieldMapper.OpenBuilder<T extends JsonFieldMapper.Builder,Y extends JsonFieldMapper>
 
Nested classes/interfaces inherited from interface org.elasticsearch.index.mapper.json.JsonMapper
JsonMapper.BuilderContext
 
Nested classes/interfaces inherited from interface org.elasticsearch.util.json.ToJson
ToJson.MapParams, ToJson.Params
 
Nested classes/interfaces inherited from interface org.elasticsearch.index.mapper.FieldMapper
FieldMapper.Names
 
Field Summary
static java.lang.String JSON_TYPE
           
 
Fields inherited from class org.elasticsearch.index.mapper.json.JsonNumberFieldMapper
includeInAll, precisionStep
 
Fields inherited from class org.elasticsearch.index.mapper.json.JsonFieldMapper
boost, index, indexAnalyzer, names, omitNorms, omitTermFreqAndPositions, searchAnalyzer, store, termVector
 
Fields inherited from interface org.elasticsearch.index.mapper.json.JsonMapper
EMPTY_ARRAY
 
Fields inherited from interface org.elasticsearch.util.json.ToJson
EMPTY_PARAMS
 
Constructor Summary
protected JsonDateFieldMapper(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  void doJsonBody(JsonBuilder 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  java.lang.String jsonType()
           
protected  int maxPrecisionStep()
           
protected  org.apache.lucene.document.Field parseCreateField(JsonParseContext jsonContext)
           
 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.json.JsonNumberFieldMapper
includeInAll, popCachedStream, precisionStep, shouldBreakTermEnumeration, useFieldQueryWithQueryString
 
Methods inherited from class org.elasticsearch.index.mapper.json.JsonFieldMapper
analyzed, boost, fieldFilter, fieldQuery, index, indexAnalyzer, indexed, merge, name, names, omitNorms, omitTermFreqAndPositions, parse, queryStringTermQuery, searchAnalyzer, store, stored, termVector, toJson, 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.json.JsonMapper
merge, name, parse, traverse
 
Methods inherited from interface org.elasticsearch.util.json.ToJson
toJson
 

Field Detail

JSON_TYPE

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

JsonDateFieldMapper

protected JsonDateFieldMapper(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 JsonNumberFieldMapper<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 JsonNumberFieldMapper<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 JsonFieldMapper<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 JsonNumberFieldMapper<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 JsonFieldMapper<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 JsonFieldMapper<java.lang.Long>

valueFromTerm

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

Specified by:
valueFromTerm in interface FieldMapper<java.lang.Long>
Specified by:
valueFromTerm in class JsonNumberFieldMapper<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 JsonNumberFieldMapper<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>
Overrides:
rangeQuery in class JsonFieldMapper<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>
Overrides:
rangeFilter in class JsonFieldMapper<java.lang.Long>

parseCreateField

protected org.apache.lucene.document.Field parseCreateField(JsonParseContext jsonContext)
                                                     throws java.io.IOException
Specified by:
parseCreateField in class JsonFieldMapper<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 JsonNumberFieldMapper<java.lang.Long>

jsonType

protected java.lang.String jsonType()
Specified by:
jsonType in class JsonFieldMapper<java.lang.Long>

doJsonBody

protected void doJsonBody(JsonBuilder builder)
                   throws java.io.IOException
Overrides:
doJsonBody in class JsonNumberFieldMapper<java.lang.Long>
Throws:
java.io.IOException