Package org.apache.solr.schema
Class NumericFieldType
- java.lang.Object
-
- org.apache.solr.schema.FieldProperties
-
- org.apache.solr.schema.FieldType
-
- org.apache.solr.schema.PrimitiveFieldType
-
- org.apache.solr.schema.NumericFieldType
-
- Direct Known Subclasses:
PointField,TrieField
public abstract class NumericFieldType extends PrimitiveFieldType
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.schema.FieldType
FieldType.DefaultAnalyzer, FieldType.MultiValueSelector
-
-
Field Summary
Fields Modifier and Type Field Description static EnumSet<NumberType>doubleOrFloatprotected NumberTypetype-
Fields inherited from class org.apache.solr.schema.FieldType
ANALYZER, args, AUTO_GENERATE_PHRASE_QUERIES, CHAR_FILTER, CHAR_FILTERS, CLASS_NAME, docValuesFormat, ENABLE_GRAPH_QUERIES, falseProperties, FILTER, FILTERS, INDEX, INDEX_ANALYZER, MULTI_TERM, MULTI_TERM_ANALYZER, POLY_FIELD_SEPARATOR, postingsFormat, properties, QUERY, QUERY_ANALYZER, similarity, SIMILARITY, similarityFactory, SYNONYM_QUERY_STYLE, TOKENIZER, trueProperties, TYPE, TYPE_NAME, typeName
-
Fields inherited from class org.apache.solr.schema.FieldProperties
BINARY, DOC_VALUES, INDEXED, LARGE_FIELD, 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, UNINVERTIBLE, USE_DOCVALUES_AS_STORED
-
-
Constructor Summary
Constructors Constructor Description NumericFieldType()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.lucene.search.QuerygetDocValuesRangeQuery(QParser parser, SchemaField field, String min, String max, boolean minInclusive, boolean maxInclusive)NumberTypegetNumberType()Return the numeric type of this field, or null if this field is not a numeric field.protected org.apache.lucene.search.QuerygetRangeQueryForFloatDoubleDocValues(SchemaField sf, String min, String max, boolean minInclusive, boolean maxInclusive)protected org.apache.lucene.search.QuerygetRangeQueryForMultiValuedDoubleDocValues(SchemaField sf, String min, String max, boolean minInclusive, boolean maxInclusive)protected org.apache.lucene.search.QuerygetRangeQueryForMultiValuedFloatDocValues(SchemaField sf, String min, String max, boolean minInclusive, boolean maxInclusive)org.apache.lucene.search.QuerygetSpecializedExistenceQuery(QParser parser, SchemaField field)Override the default existence behavior, so that the non-docValued/norms implementation matches NaN values for double and float fields.static org.apache.lucene.search.QuerynumericDocValuesRangeQuery(String field, Number lowerValue, Number upperValue, boolean lowerInclusive, boolean upperInclusive, boolean multiValued)protected booleantreatUnboundedRangeAsExistence(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).-
Methods inherited from class org.apache.solr.schema.PrimitiveFieldType
checkSupportsDocValues, enableDocValuesByDefault, getDefaultMultiValueSelectorForSort, init
-
Methods inherited from class org.apache.solr.schema.FieldType
checkSchemaField, createField, createField, createFields, getAnalyzerProperties, getClassArg, getDocValuesFormat, getExistenceQuery, getFieldQuery, getFieldTermQuery, getIndexAnalyzer, getNamedPropertyValues, getNonFieldPropertyArgs, getNumericSort, getPostingsFormat, getPrefixQuery, getQueryAnalyzer, getRangeQuery, getRewriteMethod, getSetQuery, getSimilarity, getSimilarityFactory, getSingleValueSource, getSortedNumericSortField, getSortedSetSortField, getSortField, getSortField, getSpecializedRangeQuery, getStringSort, getTypeName, getUninversionType, getValueSource, hasProperty, indexedToReadable, indexedToReadable, isExplicitAnalyzer, isExplicitQueryAnalyzer, isMultiValued, isPointField, isPolyField, isTokenized, isUtf8Field, 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, write, write
-
-
-
-
Field Detail
-
type
protected NumberType type
-
doubleOrFloat
public static EnumSet<NumberType> doubleOrFloat
-
-
Method Detail
-
getNumberType
public NumberType getNumberType()
Description copied from class:FieldTypeReturn the numeric type of this field, or null if this field is not a numeric field.- Overrides:
getNumberTypein classFieldType- 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:
treatUnboundedRangeAsExistencein classFieldType- 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:
getSpecializedExistenceQueryin classFieldType- Parameters:
parser- TheQParsercalling the methodfield- TheSchemaFieldof the field to search- Returns:
- The
Queryinstance.
-
-