Class 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
    • 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()
      • getProperties

        public int getProperties()
      • isUninvertible

        public boolean isUninvertible()
      • indexed

        public boolean indexed()
      • stored

        public boolean stored()
        Specified by:
        stored in interface org.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 interface org.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()
      • getArgs

        public Map<String,​?> getArgs()
      • createField

        public org.apache.lucene.index.IndexableField createField​(Object val)
      • createFields

        public List<org.apache.lucene.index.IndexableField> createFields​(Object val)
      • getPostingsFormat

        public String getPostingsFormat()
        Expert/advanced method to get the field PostingsFormat.
        Returns:
        The postingsFormat declared; or null if unspecified.
      • getDocValuesFormat

        public String getDocValuesFormat()
        Expert/advanced method to get the field DocValuesFormat.
        Returns:
        The docValuesFormat declared; or null if unspecified.
      • checkSortability

        public void checkSortability()
                              throws org.apache.solr.common.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
        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.SolrException
        Sanity checks that the properties of this field type are plausible for a field that may be used to get a FieldCacheSource, 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()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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:
        tokenized in interface org.apache.lucene.index.IndexableFieldType
      • storeTermVectors

        public boolean storeTermVectors()
        Specified by:
        storeTermVectors in interface org.apache.lucene.index.IndexableFieldType
      • storeTermVectorOffsets

        public boolean storeTermVectorOffsets()
        Specified by:
        storeTermVectorOffsets in interface org.apache.lucene.index.IndexableFieldType
      • storeTermVectorPositions

        public boolean storeTermVectorPositions()
        Specified by:
        storeTermVectorPositions in interface org.apache.lucene.index.IndexableFieldType
      • storeTermVectorPayloads

        public boolean storeTermVectorPayloads()
        Specified by:
        storeTermVectorPayloads in interface org.apache.lucene.index.IndexableFieldType
      • indexOptions

        public org.apache.lucene.index.IndexOptions indexOptions()
        Specified by:
        indexOptions in interface org.apache.lucene.index.IndexableFieldType
      • docValuesType

        public org.apache.lucene.index.DocValuesType docValuesType()
        Specified by:
        docValuesType in interface org.apache.lucene.index.IndexableFieldType
      • pointDimensionCount

        public int pointDimensionCount()
        Specified by:
        pointDimensionCount in interface org.apache.lucene.index.IndexableFieldType
      • pointIndexDimensionCount

        public int pointIndexDimensionCount()
        Specified by:
        pointIndexDimensionCount in interface org.apache.lucene.index.IndexableFieldType
      • pointNumBytes

        public int pointNumBytes()
        Specified by:
        pointNumBytes in interface org.apache.lucene.index.IndexableFieldType
      • vectorDimension

        public int vectorDimension()
        Specified by:
        vectorDimension in interface org.apache.lucene.index.IndexableFieldType
      • vectorEncoding

        public org.apache.lucene.index.VectorEncoding vectorEncoding()
        Specified by:
        vectorEncoding in interface org.apache.lucene.index.IndexableFieldType
      • vectorSimilarityFunction

        public org.apache.lucene.index.VectorSimilarityFunction vectorSimilarityFunction()
        Specified by:
        vectorSimilarityFunction in interface org.apache.lucene.index.IndexableFieldType
      • getAttributes

        public Map<String,​String> getAttributes()
        Specified by:
        getAttributes in interface org.apache.lucene.index.IndexableFieldType