public class SortableTextField extends TextField
SortableTextField is a specialized form of TextField that supports
Sorting and ValueSource functions, using docValues built from the first
maxCharsForDocValues characters of the original (pre-analyzed) String values of this field.
The implicit default value for maxCharsForDocValues is 1024. If a field
type instance is configured with maxCharsForDocValues <= 0 this overrides the default
with an effective value of "no limit" (Integer.MAX_VALUE).
Instances of this FieldType implicitly default to docValues="true" unless explicitly
configured with docValues="false".
Just like StrField, instances of this field that are multiValued="true" support
the field(name,min|max) function, and implicitly sort on min|max depending
on the asc|desc direction selector.
NOTE: Unlike most other FieldTypes, this class defaults to
useDocValuesAsStored="false". If an instance of this type (or a field that uses this type)
overrides this behavior to set useDocValuesAsStored="true" then instead of truncating the
original string value based on the effective value of maxCharsForDocValues, this class
will reject any documents w/a field value longer then that limit -- causing the document update to fail.
This behavior exists to prevent situations that could result in a search client reieving only a truncated
version of the original field value in place of a stored value.
FieldType.DefaultAnalyzer, FieldType.MultiValueSelector| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_CHARS_FOR_DOC_VALUES |
autoGeneratePhraseQueries, enableGraphQueries, multiTermAnalyzer, synonymQueryStyleANALYZER, 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, typeNameBINARY, 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 |
|---|
SortableTextField() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkSupportsDocValues()
Called by
FieldType.checkSchemaField(SchemaField) if the field has docValues. |
List<IndexableField> |
createFields(SchemaField field,
Object value)
Given a
SchemaField, create one or more IndexableField instances |
FieldType.MultiValueSelector |
getDefaultMultiValueSelectorForSort(SchemaField field,
boolean reverse)
Method for indicating which
FieldType.MultiValueSelector (if any) should be used when
sorting on a multivalued field of this type for the specified direction (asc/desc). |
ValueSource |
getSingleValueSource(FieldType.MultiValueSelector choice,
SchemaField field,
QParser parser)
Method for dynamically building a ValueSource based on a single value of a multivalued field.
|
SortField |
getSortField(SchemaField field,
boolean reverse)
Returns the SortField instance that should be used to sort fields
of this type.
|
UninvertingReader.Type |
getUninversionType(SchemaField sf)
If DocValues is not enabled for a field, but it's indexed, docvalues can be constructed
on the fly (uninverted, aka fieldcache) on the first request to sort, facet, etc.
|
ValueSource |
getValueSource(SchemaField field,
QParser parser)
called to get the default value source (normally, from the
Lucene FieldCache.)
|
protected void |
init(IndexSchema schema,
Map<String,String> args)
subclasses should initialize themselves with the args provided
and remove valid arguments.
|
boolean |
multiValuedFieldCache()
Returns true if a single field value of this type has multiple logical values
for the purposes of faceting, sorting, etc.
|
analyzeMultiTerm, getAutoGeneratePhraseQueries, getEnableGraphQueries, getFieldQuery, getMultiTermAnalyzer, getSpecializedRangeQuery, getSynonymQueryStyle, isExplicitMultiTermAnalyzer, isUtf8Field, marshalSortValue, setIsExplicitMultiTermAnalyzer, setMultiTermAnalyzer, supportsAnalyzers, toObject, unmarshalSortValue, writecheckSchemaField, createField, createField, getAnalyzerProperties, getClassArg, getDocValuesFormat, getExistenceQuery, getIndexAnalyzer, getNamedPropertyValues, getNonFieldPropertyArgs, getNumberType, getNumericSort, getPostingsFormat, getPrefixQuery, getQueryAnalyzer, getRangeQuery, getRewriteMethod, getSetQuery, getSimilarity, getSimilarityFactory, getSortedNumericSortField, getSortedSetSortField, getSortField, getSpecializedExistenceQuery, getStringSort, getTypeName, hasProperty, indexedToReadable, indexedToReadable, isExplicitAnalyzer, isExplicitQueryAnalyzer, isMultiValued, isPointField, isPolyField, isTokenized, marshalBase64SortValue, marshalStringSortValue, readableToIndexed, readableToIndexed, restrictProps, setArgs, setIndexAnalyzer, setIsExplicitAnalyzer, setIsExplicitQueryAnalyzer, setQueryAnalyzer, setSimilarity, storedToIndexed, storedToReadable, toExternal, toInternal, toNativeType, toObject, toString, treatUnboundedRangeAsExistence, unmarshalBase64SortValue, unmarshalStringSortValue, useDocValuesAsStored, writepublic static final int DEFAULT_MAX_CHARS_FOR_DOC_VALUES
protected void init(IndexSchema schema, Map<String,String> args)
FieldTypepublic List<IndexableField> createFields(SchemaField field, Object value)
FieldTypeSchemaField, create one or more IndexableField instancescreateFields in class FieldTypefield - the SchemaFieldvalue - The value to add to the fieldIndexableFieldFieldType.createField(SchemaField, Object),
FieldType.isPolyField()protected void checkSupportsDocValues()
FieldType.checkSchemaField(SchemaField) if the field has docValues. By default none do.
this field type supports DocValues, this method is always a No-OpcheckSupportsDocValues in class FieldTypepublic SortField getSortField(SchemaField field, boolean reverse)
FieldTypepublic ValueSource getValueSource(SchemaField field, QParser parser)
FieldTypegetValueSource in class TextFieldpublic FieldType.MultiValueSelector getDefaultMultiValueSelectorForSort(SchemaField field, boolean reverse)
FieldTypeFieldType.MultiValueSelector (if any) should be used when
sorting on a multivalued field of this type for the specified direction (asc/desc).
The default implementation returns null (for all inputs).getDefaultMultiValueSelectorForSort in class FieldTypefield - The SchemaField (of this type) in questionreverse - false if this is an ascending sort, true if this is a descending sort.FieldType.MultiValueSelectorpublic ValueSource getSingleValueSource(FieldType.MultiValueSelector choice, SchemaField field, QParser parser)
FieldTypeSchemaField 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 FieldTypeFieldType.MultiValueSelectorpublic UninvertingReader.Type getUninversionType(SchemaField sf)
If DocValues is not enabled for a field, but it's indexed, docvalues can be constructed on the fly (uninverted, aka fieldcache) on the first request to sort, facet, etc. This specifies the structure to use.
This method will not be used if the field is (effectively) uninvertible="false"
getUninversionType in class TextFieldsf - field instancenull (to disallow uninversion for the field)SchemaField.isUninvertible()public boolean multiValuedFieldCache()
multiValuedFieldCache in class FieldTypeCopyright © 2000-2020 Apache Software Foundation. All Rights Reserved.