Package org.apache.solr.schema
Class UUIDField
- java.lang.Object
-
- org.apache.solr.schema.FieldProperties
-
- org.apache.solr.schema.FieldType
-
- org.apache.solr.schema.PrimitiveFieldType
-
- org.apache.solr.schema.StrField
-
- org.apache.solr.schema.UUIDField
-
public class UUIDField extends StrField
This FieldType accepts UUID string values, as well as the special value of "NEW" which triggers generation of a new random UUID.NOTE: Configuring a
UUIDField
instance with a default value of "NEW
" is not advisable for most users when using SolrCloud (and not possible if the UUID value is configured as the unique key field) since the result will be that each replica of each document will get a unique UUID value. UsingUUIDUpdateProcessorFactory
to generate UUID values when documents are added is recommended instead.- See Also:
UUID.toString()
,UUID.randomUUID()
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.schema.FieldType
FieldType.DefaultAnalyzer, FieldType.MultiValueSelector
-
-
Field Summary
-
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 UUIDField()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.lucene.search.SortField
getSortField(SchemaField field, boolean reverse)
Returns the SortField instance that should be used to sort fields of this type.protected void
init(IndexSchema schema, Map<String,String> args)
subclasses should initialize themselves with the args provided and remove valid arguments.String
toInternal(String val)
Generates a UUID if val is either null, empty or "NEW".String
toInternal(UUID uuid)
void
write(TextResponseWriter writer, String name, org.apache.lucene.index.IndexableField f)
calls back to TextResponseWriter to write the field value-
Methods inherited from class org.apache.solr.schema.StrField
createFields, getBytesRef, getSingleValueSource, getUninversionType, getValueSource, isUtf8Field, marshalSortValue, toObject, unmarshalSortValue
-
Methods inherited from class org.apache.solr.schema.PrimitiveFieldType
checkSupportsDocValues, enableDocValuesByDefault, getDefaultMultiValueSelectorForSort
-
Methods inherited from class org.apache.solr.schema.FieldType
checkSchemaField, createField, createField, getAnalyzerProperties, getClassArg, getDocValuesFormat, getExistenceQuery, getFieldQuery, getFieldTermQuery, getIndexAnalyzer, getNamedPropertyValues, getNonFieldPropertyArgs, getNumberType, getNumericSort, getPostingsFormat, getPrefixQuery, getQueryAnalyzer, getRangeQuery, getRewriteMethod, getSetQuery, getSimilarity, getSimilarityFactory, getSortedNumericSortField, getSortedSetSortField, getSortField, getSpecializedExistenceQuery, getSpecializedRangeQuery, getStringSort, getTypeName, hasProperty, indexedToReadable, indexedToReadable, isExplicitAnalyzer, isExplicitQueryAnalyzer, isMultiValued, isPointField, isPolyField, isTokenized, marshalBase64SortValue, marshalStringSortValue, multiValuedFieldCache, readableToIndexed, readableToIndexed, restrictProps, setArgs, setIndexAnalyzer, setIsExplicitAnalyzer, setIsExplicitQueryAnalyzer, setQueryAnalyzer, setSimilarity, storedToIndexed, storedToReadable, supportsAnalyzers, toExternal, toNativeType, toObject, toString, treatUnboundedRangeAsExistence, unmarshalBase64SortValue, unmarshalStringSortValue, useDocValuesAsStored, write
-
-
-
-
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.
-
getSortField
public org.apache.lucene.search.SortField getSortField(SchemaField field, boolean reverse)
Description copied from class:FieldType
Returns the SortField instance that should be used to sort fields of this type.
-
write
public void write(TextResponseWriter writer, String name, org.apache.lucene.index.IndexableField f) throws IOException
Description copied from class:FieldType
calls back to TextResponseWriter to write the field valueSub-classes should prefer using
FieldType.toExternal(IndexableField)
orFieldType.toObject(IndexableField)
to get the writeable external value off
instead of directly usingf.stringValue()
orf.binaryValue()
- Overrides:
write
in classStrField
- Throws:
IOException
-
toInternal
public String toInternal(String val)
Generates a UUID if val is either null, empty or "NEW".Otherwise it behaves much like a StrField but checks that the value given is indeed a valid UUID.
- Overrides:
toInternal
in classFieldType
- Parameters:
val
- The value of the field- See Also:
FieldType.toInternal(java.lang.String)
-
-