Class NumericFieldType

Direct Known Subclasses:
PointField, TrieField

public abstract class NumericFieldType extends PrimitiveFieldType
  • Field Details

  • Constructor Details

    • NumericFieldType

      public NumericFieldType()
  • Method Details

    • getNumberType

      public NumberType getNumberType()
      Description copied from class: FieldType
      Return the numeric type of this field, or null if this field is not a numeric field.
      Overrides:
      getNumberType in class FieldType
      Returns:
      the type of this field
    • getDocValuesRangeQuery

      protected org.apache.lucene.search.Query getDocValuesRangeQuery(QParser parser, SchemaField field, String min, String max, boolean minInclusive, boolean maxInclusive)
    • getRangeQueryForFloatDoubleDocValues

      protected org.apache.lucene.search.Query getRangeQueryForFloatDoubleDocValues(SchemaField sf, String min, String max, boolean minInclusive, boolean maxInclusive)
    • getRangeQueryForMultiValuedDoubleDocValues

      protected org.apache.lucene.search.Query getRangeQueryForMultiValuedDoubleDocValues(SchemaField sf, String min, String max, boolean minInclusive, boolean maxInclusive)
    • getRangeQueryForMultiValuedFloatDocValues

      protected org.apache.lucene.search.Query getRangeQueryForMultiValuedFloatDocValues(SchemaField sf, String min, String max, boolean minInclusive, boolean maxInclusive)
    • numericDocValuesRangeQuery

      public static org.apache.lucene.search.Query numericDocValuesRangeQuery(String field, Number lowerValue, Number upperValue, boolean lowerInclusive, boolean upperInclusive, boolean multiValued)
    • treatUnboundedRangeAsExistence

      protected boolean treatUnboundedRangeAsExistence(SchemaField field)
      For doubles and floats, unbounded range queries (which do not match NaN values) are not equivalent to existence queries (which do match NaN values).

      The two types of queries are equivalent for all other numeric types.

      Overrides:
      treatUnboundedRangeAsExistence in class FieldType
      Parameters:
      field - the schema field
      Returns:
      false for double and float fields, true for all others
    • getSpecializedExistenceQuery

      public org.apache.lucene.search.Query getSpecializedExistenceQuery(QParser parser, SchemaField field)
      Override the default existence behavior, so that the non-docValued/norms implementation matches NaN values for double and float fields. The [* TO *] query for those fields does not match 'NaN' values, so they must be matched separately.

      For doubles and floats the query behavior is equivalent to (field:[* TO *] OR field:NaN). For all other numeric types, the default existence query behavior is used.

      Overrides:
      getSpecializedExistenceQuery in class FieldType
      Parameters:
      parser - The QParser calling the method
      field - The SchemaField of the field to search
      Returns:
      The Query instance.