Class DateRangeField

  • All Implemented Interfaces:
    DateValueFieldType, SpatialQueryable

    public class DateRangeField
    extends AbstractSpatialPrefixTreeFieldType<org.apache.lucene.spatial.prefix.NumberRangePrefixTreeStrategy>
    implements DateValueFieldType
    A field for indexed dates and date ranges. It's mostly compatible with DatePointField. It has the potential to allow efficient faceting, similar to facet.enum.
    See Also:
    NumberRangePrefixTreeStrategy, DateRangePrefixTree
    • 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<org.apache.lucene.spatial.prefix.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<org.apache.lucene.spatial.prefix.NumberRangePrefixTreeStrategy>
      • parseShape

        public org.apache.lucene.spatial.prefix.tree.NumberRangePrefixTree.NRShape parseShape​(String str)
        Description copied from class: AbstractSpatialFieldType
        Create a Shape from the input string
        Overrides:
        parseShape in class AbstractSpatialFieldType<org.apache.lucene.spatial.prefix.NumberRangePrefixTreeStrategy>
      • getRangeQuery

        public org.apache.lucene.search.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<org.apache.lucene.spatial.prefix.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