public abstract class PointField extends NumericFieldType
IntPoint
, LongPoint
, FloatPoint
and
DoublePoint
.
See PointRangeQuery
for more details.
It supports integer, float, long and double types. See subclasses for details.
DocValues
are supported for single-value cases (NumericDocValues
).
FieldCache
is not supported for PointField
s, so sorting, faceting, etc on these fields require the use of docValues="true"
in the schema.FieldType.DefaultAnalyzer, FieldType.MultiValueSelector
Modifier and Type | Field and Description |
---|---|
static boolean |
TEST_HACK_IGNORE_USELESS_TRIEFIELD_ARGS
The Test framework can set this global variable to instruct PointField that
(on init) it should be tollerant of the
precisionStep argument used by TrieFields. |
doubleOrFloat, type
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
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 and Description |
---|
PointField() |
Modifier and Type | Method and Description |
---|---|
List<IndexableField> |
createFields(SchemaField sf,
Object value)
Given a
SchemaField , create one or more IndexableField instances |
protected abstract Query |
getExactQuery(SchemaField field,
String externalVal) |
Query |
getFieldQuery(QParser parser,
SchemaField field,
String externalVal)
Returns a Query instance for doing searches against a field.
|
abstract Query |
getPointRangeQuery(QParser parser,
SchemaField field,
String min,
String max,
boolean minInclusive,
boolean maxInclusive) |
Query |
getPrefixQuery(QParser parser,
SchemaField sf,
String termStr)
Returns a Query instance for doing prefix searches on this field type.
|
Query |
getSetQuery(QParser parser,
SchemaField field,
Collection<String> externalVals) |
ValueSource |
getSingleValueSource(FieldType.MultiValueSelector choice,
SchemaField field,
QParser parser)
Method for dynamically building a ValueSource based on a single value of a multivalued field.
|
protected abstract ValueSource |
getSingleValueSource(SortedNumericSelector.Type choice,
SchemaField field)
Helper method that will only be called for multivalued Point fields that have doc values.
|
SortField |
getSortField(SchemaField field,
boolean top)
Returns the SortField instance that should be used to sort fields
of this type.
|
protected Query |
getSpecializedRangeQuery(QParser parser,
SchemaField field,
String min,
String max,
boolean minInclusive,
boolean maxInclusive)
Returns a Query instance for doing range searches on this field type.
|
protected abstract StoredField |
getStoredField(SchemaField sf,
Object value) |
protected abstract String |
indexedToReadable(BytesRef indexedForm) |
CharsRef |
indexedToReadable(BytesRef indexedForm,
CharsRefBuilder charsRef)
Given an indexed term, append the human readable representation
|
String |
indexedToReadable(String indexedForm)
Given an indexed term, return the human readable representation
|
protected void |
init(IndexSchema schema,
Map<String,String> args)
NOTE: This method can be removed completely when
TEST_HACK_IGNORE_USELESS_TRIEFIELD_ARGS is removed |
protected boolean |
isFieldUsed(SchemaField field) |
boolean |
isPointField() |
boolean |
isTokenized()
Returns true if fields of this type should be tokenized
|
boolean |
multiValuedFieldCache()
Returns true if a single field value of this type has multiple logical values
for the purposes of faceting, sorting, etc.
|
String |
storedToIndexed(IndexableField f)
Given the stored field, return the indexed form
|
String |
storedToReadable(IndexableField f)
Given the stored field, return the human readable representation
|
String |
toInternal(String val)
Convert an external value (from XML update command or from query string)
into the internal format for both storing and indexing (which can be modified by any analyzers).
|
BytesRef |
toInternalByteRef(String val) |
void |
write(TextResponseWriter writer,
String name,
IndexableField f)
calls back to TextResponseWriter to write the field value
|
getDocValuesRangeQuery, getNumberType, getRangeQueryForFloatDoubleDocValues, getRangeQueryForMultiValuedDoubleDocValues, getRangeQueryForMultiValuedFloatDocValues, getSpecializedExistenceQuery, numericDocValuesRangeQuery, treatUnboundedRangeAsExistence
checkSupportsDocValues, getDefaultMultiValueSelectorForSort
checkSchemaField, createField, createField, getAnalyzerProperties, getClassArg, getDocValuesFormat, getExistenceQuery, getIndexAnalyzer, getNamedPropertyValues, getNonFieldPropertyArgs, getNumericSort, getPostingsFormat, getQueryAnalyzer, getRangeQuery, getRewriteMethod, getSimilarity, getSimilarityFactory, getSortedNumericSortField, getSortedSetSortField, getSortField, getStringSort, getTypeName, getUninversionType, getValueSource, hasProperty, isExplicitAnalyzer, isExplicitQueryAnalyzer, isMultiValued, isPolyField, isUtf8Field, marshalBase64SortValue, marshalSortValue, marshalStringSortValue, readableToIndexed, readableToIndexed, restrictProps, setArgs, setIndexAnalyzer, setIsExplicitAnalyzer, setIsExplicitQueryAnalyzer, setQueryAnalyzer, setSimilarity, supportsAnalyzers, toExternal, toNativeType, toObject, toObject, toString, unmarshalBase64SortValue, unmarshalSortValue, unmarshalStringSortValue, useDocValuesAsStored, write
public static boolean TEST_HACK_IGNORE_USELESS_TRIEFIELD_ARGS
The Test framework can set this global variable to instruct PointField that
(on init) it should be tollerant of the precisionStep
argument used by TrieFields.
This allows for simple randomization of TrieFields and PointFields w/o extensive duplication
of <fieldType/>
declarations.
NOTE: When TrieField
is removed, this boolean must also be removed
protected void init(IndexSchema schema, Map<String,String> args)
TEST_HACK_IGNORE_USELESS_TRIEFIELD_ARGS
is removedinit
in class PrimitiveFieldType
public boolean isPointField()
isPointField
in class FieldType
public final ValueSource getSingleValueSource(FieldType.MultiValueSelector choice, SchemaField field, QParser parser)
FieldType
SchemaField
that is in fact not-multivalued, in which case it delegates to
FieldType.getValueSource(org.apache.solr.schema.SchemaField, org.apache.solr.search.QParser)
getSingleValueSource
in class FieldType
FieldType.MultiValueSelector
protected abstract ValueSource getSingleValueSource(SortedNumericSelector.Type choice, SchemaField field)
choice
- the selector Type to use, will never be nullfield
- the field to use, guaranteed to be multivalued.FieldType.getSingleValueSource(MultiValueSelector,SchemaField,QParser)
public boolean isTokenized()
FieldType
isTokenized
in class FieldType
public boolean multiValuedFieldCache()
FieldType
multiValuedFieldCache
in class FieldType
public Query getSetQuery(QParser parser, SchemaField field, Collection<String> externalVals)
getSetQuery
in class FieldType
public Query getFieldQuery(QParser parser, SchemaField field, String externalVal)
FieldType
getFieldQuery
in class FieldType
parser
- The QParser
calling the methodfield
- The SchemaField
of the field to searchexternalVal
- The String representation of the value to searchQuery
instance. This implementation returns a TermQuery
but overriding queries may notprotected abstract Query getExactQuery(SchemaField field, String externalVal)
protected Query getSpecializedRangeQuery(QParser parser, SchemaField field, String min, String max, boolean minInclusive, boolean maxInclusive)
FieldType
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.
This method does not, and should not, check for or handle existence queries, please look at FieldType.getRangeQuery(org.apache.solr.search.QParser, org.apache.solr.schema.SchemaField, java.lang.String, java.lang.String, boolean, boolean)
for that logic.
getSpecializedRangeQuery
in class FieldType
parser
- the QParser
calling the methodfield
- the schema fieldmin
- the lower boundary of the range, nulls are allowed.max
- the upper boundary of the range, nulls are allowedminInclusive
- whether the minimum of the range is inclusive or notmaxInclusive
- whether the maximum of the range is inclusive or notpublic abstract Query getPointRangeQuery(QParser parser, SchemaField field, String min, String max, boolean minInclusive, boolean maxInclusive)
public String storedToReadable(IndexableField f)
FieldType
storedToReadable
in class FieldType
public String toInternal(String val)
FieldType
toInternal
in class FieldType
FieldType.toExternal(org.apache.lucene.index.IndexableField)
public void write(TextResponseWriter writer, String name, IndexableField f) throws IOException
FieldType
Sub-classes should prefer using FieldType.toExternal(IndexableField)
or FieldType.toObject(IndexableField)
to get the writeable external value of f
instead of directly using f.stringValue()
or f.binaryValue()
write
in class FieldType
IOException
public String storedToIndexed(IndexableField f)
FieldType
storedToIndexed
in class FieldType
public CharsRef indexedToReadable(BytesRef indexedForm, CharsRefBuilder charsRef)
FieldType
indexedToReadable
in class FieldType
public String indexedToReadable(String indexedForm)
FieldType
indexedToReadable
in class FieldType
public Query getPrefixQuery(QParser parser, SchemaField sf, String termStr)
FieldType
Sub-classes should override this method to provide their own range query implementation.
getPrefixQuery
in class FieldType
parser
- the QParser
calling the methodsf
- the schema fieldtermStr
- the term string for prefix query, if blank then this query should match all docs with this fieldprotected boolean isFieldUsed(SchemaField field)
public List<IndexableField> createFields(SchemaField sf, Object value)
FieldType
SchemaField
, create one or more IndexableField
instancescreateFields
in class FieldType
sf
- the SchemaField
value
- The value to add to the fieldIndexableField
FieldType.createField(SchemaField, Object)
,
FieldType.isPolyField()
protected abstract StoredField getStoredField(SchemaField sf, Object value)
public SortField getSortField(SchemaField field, boolean top)
FieldType
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.