org.apache.solr.schema

## Class DateRangeField

- java.lang.Object
- - org.apache.solr.schema.FieldProperties
  - - org.apache.solr.schema.FieldType
    - - org.apache.solr.schema.AbstractSpatialFieldType<T>
      - - org.apache.solr.schema.AbstractSpatialPrefixTreeFieldType<NumberRangePrefixTreeStrategy>
        - - org.apache.solr.schema.DateRangeField

- All Implemented Interfaces:
    DateValueFieldType, SpatialQueryable

      public class DateRangeField
      extends AbstractSpatialPrefixTreeFieldType<NumberRangePrefixTreeStrategy>
      implements DateValueFieldType

  A field for indexed dates and date ranges. It's mostly compatible with TrieDateField. It has the potential to allow efficient faceting, similar to facet.enum.
  See Also:
    `NumberRangePrefixTreeStrategy`, `DateRangePrefixTree`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.solr.schema.FieldType

      `FieldType.DefaultAnalyzer, FieldType.MultiValueSelector`

  - ### Field Summary

    - ### Fields inherited from class org.apache.solr.schema.AbstractSpatialPrefixTreeFieldType

      `DEFAULT_FIELD_VALUES_ARRAY_LEN, grid`

    - ### Fields inherited from class org.apache.solr.schema.AbstractSpatialFieldType

      `argsParser, ctx, DISTANCE, distanceUnits, FILTER_PARAM, FORMAT, NONE, RECIP_DISTANCE, SCORE_PARAM, shapeReader, shapeWriter, supportedScoreModes`

    - ### Fields inherited from class org.apache.solr.schema.FieldType

      `ANALYZER, args, CHAR_FILTER, CHAR_FILTERS, CLASS_NAME, docValuesFormat, falseProperties, FILTER, FILTERS, INDEX, INDEX_ANALYZER, MULTI_TERM, MULTI_TERM_ANALYZER, POLY_FIELD_SEPARATOR, postingsFormat, properties, QUERY, QUERY_ANALYZER, similarity, SIMILARITY, similarityFactory, TOKENIZER, trueProperties, TYPE, TYPE_NAME, typeName`

    - ### Fields inherited from class org.apache.solr.schema.FieldProperties

      `BINARY, DOC_VALUES, INDEXED, MULTIVALUED, OMIT_NORMS, OMIT_POSITIONS, OMIT_TF_POSITIONS, REQUIRED, SORT_MISSING_FIRST, SORT_MISSING_LAST, STORE_OFFSETS, STORE_TERMOFFSETS, STORE_TERMPAYLOADS, STORE_TERMPOSITIONS, STORE_TERMVECTORS, STORED, TOKENIZED, USE_DOCVALUES_AS_STORED`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DateRangeField()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<IndexableField>` | `createFields(SchemaField field, Object val, float boost)` Given a `SchemaField`, create one or more `IndexableField` instances
    `Query` | `getRangeQuery(QParser parser, SchemaField field, String startStr, String endStr, boolean minInclusive, boolean maxInclusive)` Returns a Query instance for doing range searches on this field type.
    `protected String` | `getStoredValue(org.locationtech.spatial4j.shape.Shape shape, String shapeStr)` Called by `AbstractSpatialFieldType.createFields(SchemaField, Object, float)` to get the stored value.
    `protected void` | `init(IndexSchema schema, Map<String,String> args)` subclasses should initialize themselves with the args provided and remove valid arguments.
    `protected NumberRangePrefixTreeStrategy` | `newPrefixTreeStrategy(String fieldName)`
    `Date` | `parseMath(Date now, String rawval)` For easy compatibility with `DateMathParser.parseMath(Date, String)`.
    `NumberRangePrefixTree.NRShape` | `parseShape(String str)` Create a `Shape` from the input string
    `protected SpatialArgs` | `parseSpatialArgs(QParser parser, String externalVal)`
    `String` | `shapeToString(org.locationtech.spatial4j.shape.Shape shape)` Returns a String version of a shape to be used for the stored value.

    - ### Methods inherited from class org.apache.solr.schema.AbstractSpatialPrefixTreeFieldType

      `getIndexAnalyzer, getQueryAnalyzer, newSpatialStrategy`

    - ### Methods inherited from class org.apache.solr.schema.AbstractSpatialFieldType

      `createField, createSpatialQuery, getDistanceUnits, getFieldQuery, getQueryFromSpatialArgs, getSortField, getSpatialContext, getSphereRadius, getStrategy, getSupportedScoreModes, getUninversionType, getValueSource, getValueSourceFromSpatialArgs, isPolyField, newSpatialArgsParser, parseDistanceUnits, write`

    - ### Methods inherited from class org.apache.solr.schema.FieldType

      `checkSchemaField, createField, getAnalyzerProperties, getClassArg, getDocValuesFormat, getIndexOptions, getNamedPropertyValues, getNonFieldPropertyArgs, getNumericType, getPostingsFormat, getPrefixQuery, getRewriteMethod, getSimilarity, getSimilarityFactory, getSingleValueSource, getStringSort, getTypeName, hasProperty, indexedToReadable, indexedToReadable, isExplicitAnalyzer, isExplicitQueryAnalyzer, isMultiValued, isTokenized, marshalBase64SortValue, marshalSortValue, marshalStringSortValue, multiValuedFieldCache, readableToIndexed, readableToIndexed, restrictProps, setArgs, setIndexAnalyzer, setIsExplicitAnalyzer, setIsExplicitQueryAnalyzer, setQueryAnalyzer, setSimilarity, storedToIndexed, storedToReadable, supportsAnalyzers, toExternal, toInternal, toNativeType, toObject, toObject, toString, unmarshalBase64SortValue, unmarshalSortValue, unmarshalStringSortValue, useDocValuesAsStored`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### DateRangeField

          public DateRangeField()

  - ### Method Detail

    - #### init

          protected void init(IndexSchema schema,
                              Map<String,String> args)

      Description copied from class: `FieldType`
      subclasses should initialize themselves with the args provided and remove valid arguments. leftover arguments will cause an exception. Common boolean properties have already been handled.
      Overrides:
        `init` in class `AbstractSpatialPrefixTreeFieldType<NumberRangePrefixTreeStrategy>`

    - #### newPrefixTreeStrategy

          protected NumberRangePrefixTreeStrategy newPrefixTreeStrategy(String fieldName)

      Specified by:
        `newPrefixTreeStrategy` in class `AbstractSpatialPrefixTreeFieldType<NumberRangePrefixTreeStrategy>`

    - #### createFields

          public List<IndexableField> createFields(SchemaField field,
                                                   Object val,
                                                   float boost)

      Description copied from class: `FieldType`
      Given a `SchemaField`, create one or more `IndexableField` instances
      Overrides:
        `createFields` in class `AbstractSpatialFieldType<NumberRangePrefixTreeStrategy>`
      Parameters:
        `field` - the `SchemaField`
        `val` - The value to add to the field
        `boost` - The boost to apply
      Returns:
        An array of `IndexableField`
      See Also:
        `FieldType.createField(SchemaField, Object, float)`, `FieldType.isPolyField()`

    - #### getStoredValue

          protected String getStoredValue(org.locationtech.spatial4j.shape.Shape shape,
                                          String shapeStr)

      Description copied from class: `AbstractSpatialFieldType`
      Called by `AbstractSpatialFieldType.createFields(SchemaField, Object, float)` to get the stored value.
      Overrides:
        `getStoredValue` in class `AbstractSpatialFieldType<NumberRangePrefixTreeStrategy>`

    - #### shapeToString

          public String shapeToString(org.locationtech.spatial4j.shape.Shape shape)

      Description copied from class: `AbstractSpatialFieldType`
      Returns a String version of a shape to be used for the stored value. The format can be selected using the initParam `format={WKT|GeoJSON}`
      Overrides:
        `shapeToString` in class `AbstractSpatialFieldType<NumberRangePrefixTreeStrategy>`

    - #### parseShape

          public NumberRangePrefixTree.NRShape parseShape(String str)

      Description copied from class: `AbstractSpatialFieldType`
      Create a `Shape` from the input string
      Overrides:
        `parseShape` in class `AbstractSpatialFieldType<NumberRangePrefixTreeStrategy>`

    - #### parseMath

          public Date parseMath(Date now,
                                String rawval)

      For easy compatibility with `DateMathParser.parseMath(Date, String)`.

    - #### parseSpatialArgs

          protected SpatialArgs parseSpatialArgs(QParser parser,
                                                 String externalVal)

      Overrides:
        `parseSpatialArgs` in class `AbstractSpatialFieldType<NumberRangePrefixTreeStrategy>`

    - #### getRangeQuery

          public Query getRangeQuery(QParser parser,
                                     SchemaField field,
                                     String startStr,
                                     String endStr,
                                     boolean minInclusive,
                                     boolean maxInclusive)

      Description copied from class: `FieldType`
      Returns a Query instance for doing range searches on this field type. `SolrQueryParser` currently passes part1 and part2 as null if they are '*' respectively. minInclusive and maxInclusive are both true currently by SolrQueryParser but that may change in the future. Also, other QueryParser implementations may have different semantics.

      Sub-classes should override this method to provide their own range query implementation. They should strive to handle nulls in part1 and/or part2 as well as unequal minInclusive and maxInclusive parameters gracefully.

      Overrides:
        `getRangeQuery` in class `AbstractSpatialFieldType<NumberRangePrefixTreeStrategy>`
      Parameters:
        `parser` - the `QParser` calling the method
        `field` - the schema field
        `startStr` - the lower boundary of the range, nulls are allowed.
        `endStr` - the upper boundary of the range, nulls are allowed
        `minInclusive` - whether the minimum of the range is inclusive or not
        `maxInclusive` - whether the maximum of the range is inclusive or not
      Returns:
        a Query instance to perform range search according to given parameters

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.