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 void
checkFieldCacheSource()
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.void
checkSortability()
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.IndexableField
createField(Object val)
List<org.apache.lucene.index.IndexableField>
createFields(Object val)
org.apache.lucene.index.DocValuesType
docValuesType()
boolean
equals(Object obj)
Map<String,?>
getArgs()
Map<String,String>
getAttributes()
String
getDefaultValue()
String
getDocValuesFormat()
Expert/advanced method to get the fieldDocValuesFormat
.String
getName()
SimpleOrderedMap<Object>
getNamedPropertyValues(boolean showDefaults)
Get a map of property name -> value for this field.String
getPostingsFormat()
Expert/advanced method to get the fieldPostingsFormat
.int
getProperties()
org.apache.lucene.search.SortField
getSortField(boolean top)
Delegates to the FieldType for this fieldFieldType
getType()
boolean
hasDocValues()
int
hashCode()
boolean
indexed()
org.apache.lucene.index.IndexOptions
indexOptions()
boolean
isLarge()
boolean
isPolyField()
If true, then usecreateFields(Object)
, else usecreateField(java.lang.Object)
to save an extra allocationboolean
isRequired()
boolean
isUninvertible()
boolean
multiValued()
boolean
omitNorms()
boolean
omitPositions()
boolean
omitTermFreqAndPositions()
int
pointDimensionCount()
int
pointIndexDimensionCount()
int
pointNumBytes()
boolean
sortMissingFirst()
boolean
sortMissingLast()
boolean
stored()
boolean
storeOffsetsWithPositions()
boolean
storeTermOffsets()
boolean
storeTermPayloads()
boolean
storeTermPositions()
boolean
storeTermVector()
boolean
storeTermVectorOffsets()
boolean
storeTermVectorPayloads()
boolean
storeTermVectorPositions()
boolean
storeTermVectors()
boolean
tokenized()
String
toString()
boolean
useDocValuesAsStored()
int
vectorDimension()
org.apache.lucene.index.VectorSimilarityFunction
vectorSimilarityFunction()
void
write(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:
stored
in 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:
omitNorms
in 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
postingsFormat
declared; or null if unspecified.
-
getDocValuesFormat
public String getDocValuesFormat()
Expert/advanced method to get the fieldDocValuesFormat
.- Returns:
- The
docValuesFormat
declared; or null if unspecified.
-
checkSortability
public void checkSortability() throws SolrException
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. FieldType subclasses can choose to call this method in their getSortField implementation
-
checkFieldCacheSource
public void checkFieldCacheSource() throws SolrException
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. FieldType subclasses can choose to call this method in their getValueSource implementation
-
getDefaultValue
public String getDefaultValue()
-
getNamedPropertyValues
public 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:
tokenized
in interfaceorg.apache.lucene.index.IndexableFieldType
-
storeTermVectors
public boolean storeTermVectors()
- Specified by:
storeTermVectors
in interfaceorg.apache.lucene.index.IndexableFieldType
-
storeTermVectorOffsets
public boolean storeTermVectorOffsets()
- Specified by:
storeTermVectorOffsets
in interfaceorg.apache.lucene.index.IndexableFieldType
-
storeTermVectorPositions
public boolean storeTermVectorPositions()
- Specified by:
storeTermVectorPositions
in interfaceorg.apache.lucene.index.IndexableFieldType
-
storeTermVectorPayloads
public boolean storeTermVectorPayloads()
- Specified by:
storeTermVectorPayloads
in interfaceorg.apache.lucene.index.IndexableFieldType
-
indexOptions
public org.apache.lucene.index.IndexOptions indexOptions()
- Specified by:
indexOptions
in interfaceorg.apache.lucene.index.IndexableFieldType
-
docValuesType
public org.apache.lucene.index.DocValuesType docValuesType()
- Specified by:
docValuesType
in interfaceorg.apache.lucene.index.IndexableFieldType
-
pointDimensionCount
public int pointDimensionCount()
- Specified by:
pointDimensionCount
in interfaceorg.apache.lucene.index.IndexableFieldType
-
pointIndexDimensionCount
public int pointIndexDimensionCount()
- Specified by:
pointIndexDimensionCount
in interfaceorg.apache.lucene.index.IndexableFieldType
-
pointNumBytes
public int pointNumBytes()
- Specified by:
pointNumBytes
in interfaceorg.apache.lucene.index.IndexableFieldType
-
vectorDimension
public int vectorDimension()
- Specified by:
vectorDimension
in interfaceorg.apache.lucene.index.IndexableFieldType
-
vectorSimilarityFunction
public org.apache.lucene.index.VectorSimilarityFunction vectorSimilarityFunction()
- Specified by:
vectorSimilarityFunction
in interfaceorg.apache.lucene.index.IndexableFieldType
-
-