Package org.apache.solr.schema
Class SchemaField
- java.lang.Object
-
- org.apache.solr.schema.FieldProperties
-
- org.apache.solr.schema.SchemaField
-
- All Implemented Interfaces:
org.apache.lucene.index.IndexableFieldType
public final class SchemaField extends FieldProperties implements org.apache.lucene.index.IndexableFieldType
Encapsulates all information about a Field in a Solr Schema
-
-
Field Summary
-
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 SchemaField(String name, FieldType type)Create a new SchemaField with the given name and type, using all the default properties from the type.SchemaField(String name, FieldType type, int properties, String defaultValue)Create a new SchemaField with the given name and type, and with the specified properties.SchemaField(SchemaField prototype, String name)Create a new SchemaField from an existing one by using all of the properties of the prototype except the field name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckFieldCacheSource()Sanity checks that the properties of this field type are plausible for a field that may be used to get aFieldCacheSource, throwing an appropriate exception (including the field name) if it is not.voidcheckSortability()Sanity checks that the properties of this field type are plausible for a field that may be used in sorting, throwing an appropriate exception (including the field name) if it is not.org.apache.lucene.index.IndexableFieldcreateField(Object val)List<org.apache.lucene.index.IndexableField>createFields(Object val)org.apache.lucene.index.DocValuesTypedocValuesType()booleanequals(Object obj)Map<String,?>getArgs()Map<String,String>getAttributes()StringgetDefaultValue()StringgetDocValuesFormat()Expert/advanced method to get the fieldDocValuesFormat.StringgetName()org.apache.solr.common.util.SimpleOrderedMap<Object>getNamedPropertyValues(boolean showDefaults)Get a map of property name -> value for this field.StringgetPostingsFormat()Expert/advanced method to get the fieldPostingsFormat.intgetProperties()org.apache.lucene.search.SortFieldgetSortField(boolean top)Delegates to the FieldType for this fieldFieldTypegetType()booleanhasDocValues()inthashCode()booleanindexed()org.apache.lucene.index.IndexOptionsindexOptions()booleanisLarge()booleanisPolyField()If true, then usecreateFields(Object), else usecreateField(java.lang.Object)to save an extra allocationbooleanisRequired()booleanisUninvertible()booleanmultiValued()booleanomitNorms()booleanomitPositions()booleanomitTermFreqAndPositions()intpointDimensionCount()intpointIndexDimensionCount()intpointNumBytes()booleansortMissingFirst()booleansortMissingLast()booleanstored()booleanstoreOffsetsWithPositions()booleanstoreTermOffsets()booleanstoreTermPayloads()booleanstoreTermPositions()booleanstoreTermVector()booleanstoreTermVectorOffsets()booleanstoreTermVectorPayloads()booleanstoreTermVectorPositions()booleanstoreTermVectors()booleantokenized()StringtoString()booleanuseDocValuesAsStored()intvectorDimension()org.apache.lucene.index.VectorEncodingvectorEncoding()org.apache.lucene.index.VectorSimilarityFunctionvectorSimilarityFunction()voidwrite(TextResponseWriter writer, String name, org.apache.lucene.index.IndexableField val)
-
-
-
Constructor Detail
-
SchemaField
public SchemaField(String name, FieldType type)
Create a new SchemaField with the given name and type, using all the default properties from the type.
-
SchemaField
public SchemaField(SchemaField prototype, String name)
Create a new SchemaField from an existing one by using all of the properties of the prototype except the field name.
-
SchemaField
public SchemaField(String name, FieldType type, int properties, String defaultValue)
Create a new SchemaField with the given name and type, and with the specified properties. Properties are *not* inherited from the type in this case, so users of this constructor should derive the properties from type.getSolrProperties() using all the default properties from the type.
-
-
Method Detail
-
getName
public String getName()
-
getType
public FieldType getType()
-
getProperties
public int getProperties()
-
isUninvertible
public boolean isUninvertible()
-
indexed
public boolean indexed()
-
stored
public boolean stored()
- Specified by:
storedin interfaceorg.apache.lucene.index.IndexableFieldType
-
hasDocValues
public boolean hasDocValues()
-
storeTermVector
public boolean storeTermVector()
-
storeTermPositions
public boolean storeTermPositions()
-
storeTermOffsets
public boolean storeTermOffsets()
-
storeTermPayloads
public boolean storeTermPayloads()
-
omitNorms
public boolean omitNorms()
- Specified by:
omitNormsin interfaceorg.apache.lucene.index.IndexableFieldType
-
omitTermFreqAndPositions
public boolean omitTermFreqAndPositions()
-
omitPositions
public boolean omitPositions()
-
storeOffsetsWithPositions
public boolean storeOffsetsWithPositions()
-
useDocValuesAsStored
public boolean useDocValuesAsStored()
-
multiValued
public boolean multiValued()
-
sortMissingFirst
public boolean sortMissingFirst()
-
sortMissingLast
public boolean sortMissingLast()
-
isRequired
public boolean isRequired()
-
isLarge
public boolean isLarge()
-
createField
public org.apache.lucene.index.IndexableField createField(Object val)
-
isPolyField
public boolean isPolyField()
If true, then usecreateFields(Object), else usecreateField(java.lang.Object)to save an extra allocation- Returns:
- true if this field is a poly field
-
write
public void write(TextResponseWriter writer, String name, org.apache.lucene.index.IndexableField val) throws IOException
- Throws:
IOException
-
getSortField
public org.apache.lucene.search.SortField getSortField(boolean top)
Delegates to the FieldType for this field
-
getPostingsFormat
public String getPostingsFormat()
Expert/advanced method to get the fieldPostingsFormat.- Returns:
- The
postingsFormatdeclared; or null if unspecified.
-
getDocValuesFormat
public String getDocValuesFormat()
Expert/advanced method to get the fieldDocValuesFormat.- Returns:
- The
docValuesFormatdeclared; or null if unspecified.
-
checkSortability
public void checkSortability() throws org.apache.solr.common.SolrExceptionSanity checks that the properties of this field type are plausible for a field that may be used in sorting, throwing an appropriate exception (including the field name) if it is not. FieldType subclasses can choose to call this method in their getSortField implementation- Throws:
org.apache.solr.common.SolrException- See Also:
FieldType.getSortField(org.apache.solr.schema.SchemaField, boolean)
-
checkFieldCacheSource
public void checkFieldCacheSource() throws org.apache.solr.common.SolrExceptionSanity checks that the properties of this field type are plausible for a field that may be used to get aFieldCacheSource, throwing an appropriate exception (including the field name) if it is not. FieldType subclasses can choose to call this method in their getValueSource implementation- Throws:
org.apache.solr.common.SolrException- See Also:
FieldType.getValueSource(org.apache.solr.schema.SchemaField, org.apache.solr.search.QParser)
-
getDefaultValue
public String getDefaultValue()
-
getNamedPropertyValues
public org.apache.solr.common.util.SimpleOrderedMap<Object> getNamedPropertyValues(boolean showDefaults)
Get a map of property name -> value for this field. If showDefaults is true, include default properties (those inherited from the declared property type and not overridden in the field declaration).
-
tokenized
public boolean tokenized()
- Specified by:
tokenizedin interfaceorg.apache.lucene.index.IndexableFieldType
-
storeTermVectors
public boolean storeTermVectors()
- Specified by:
storeTermVectorsin interfaceorg.apache.lucene.index.IndexableFieldType
-
storeTermVectorOffsets
public boolean storeTermVectorOffsets()
- Specified by:
storeTermVectorOffsetsin interfaceorg.apache.lucene.index.IndexableFieldType
-
storeTermVectorPositions
public boolean storeTermVectorPositions()
- Specified by:
storeTermVectorPositionsin interfaceorg.apache.lucene.index.IndexableFieldType
-
storeTermVectorPayloads
public boolean storeTermVectorPayloads()
- Specified by:
storeTermVectorPayloadsin interfaceorg.apache.lucene.index.IndexableFieldType
-
indexOptions
public org.apache.lucene.index.IndexOptions indexOptions()
- Specified by:
indexOptionsin interfaceorg.apache.lucene.index.IndexableFieldType
-
docValuesType
public org.apache.lucene.index.DocValuesType docValuesType()
- Specified by:
docValuesTypein interfaceorg.apache.lucene.index.IndexableFieldType
-
pointDimensionCount
public int pointDimensionCount()
- Specified by:
pointDimensionCountin interfaceorg.apache.lucene.index.IndexableFieldType
-
pointIndexDimensionCount
public int pointIndexDimensionCount()
- Specified by:
pointIndexDimensionCountin interfaceorg.apache.lucene.index.IndexableFieldType
-
pointNumBytes
public int pointNumBytes()
- Specified by:
pointNumBytesin interfaceorg.apache.lucene.index.IndexableFieldType
-
vectorDimension
public int vectorDimension()
- Specified by:
vectorDimensionin interfaceorg.apache.lucene.index.IndexableFieldType
-
vectorEncoding
public org.apache.lucene.index.VectorEncoding vectorEncoding()
- Specified by:
vectorEncodingin interfaceorg.apache.lucene.index.IndexableFieldType
-
vectorSimilarityFunction
public org.apache.lucene.index.VectorSimilarityFunction vectorSimilarityFunction()
- Specified by:
vectorSimilarityFunctionin interfaceorg.apache.lucene.index.IndexableFieldType
-
-