SchemaField (Solr 3.6.2 API)
Keywords: org.apache.solr.schema.SchemaField class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.solr.schema
Class SchemaField

    java.lang.Object
      org.apache.solr.schema.FieldProperties
          org.apache.solr.schema.SchemaField

    public final class SchemaField

extends FieldProperties

Encapsulates all information about a Field in a Solr Schema

Version:
  $Id: SchemaField.java 1206916 2011-11-27 23:23:00Z erick $

Field Summary

Fields inherited from class org.apache.solr.schema.FieldProperties
`BINARY, INDEXED, MULTIVALUED, OMIT_NORMS, OMIT_POSITIONS, OMIT_TF_POSITIONS, REQUIRED, SORT_MISSING_FIRST, SORT_MISSING_LAST, STORE_TERMOFFSETS, STORE_TERMPOSITIONS, STORE_TERMVECTORS, STORED, TOKENIZED`

Constructor Summary
`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(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.

Method Summary
`void` | `checkFieldCacheSource(QParser parser)` 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.
`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.
`Fieldable` | `createField(String val, float boost)`
`Fieldable[]` | `createFields(String val, float boost)`
`boolean` | `equals(Object obj)`
`String` | `getDefaultValue()`
`String` | `getName()`
`SortField` | `getSortField(boolean top)` Delegates to the FieldType for this field
`FieldType` | `getType()`
`int` | `hashCode()`
`boolean` | `indexed()`
`boolean` | `isPolyField()` If true, then use `createFields(String, float)`, else use `createField(java.lang.String, float)` to save an extra allocation
`boolean` | `isRequired()`
`boolean` | `multiValued()`
`boolean` | `omitNorms()`
`boolean` | `omitPositions()`
`boolean` | `omitTermFreqAndPositions()`
`boolean` | `omitTf()` Deprecated. Use `omitTermFreqAndPositions()`
`boolean` | `sortMissingFirst()`
`boolean` | `sortMissingLast()`
`boolean` | `stored()`
`boolean` | `storeTermOffsets()`
`boolean` | `storeTermPositions()`
`boolean` | `storeTermVector()`
`String` | `toString()`
`void` | `write(TextResponseWriter writer, String name, Fieldable val)`
`void` | `write(XMLWriter writer, String name, Fieldable val)`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

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.getProperties() using all the default properties from the type.

Method Detail

### getName

    public String getName()

### getType

    public FieldType getType()

### indexed

    public boolean indexed()

### stored

    public boolean stored()

### storeTermVector

    public boolean storeTermVector()

### storeTermPositions

    public boolean storeTermPositions()

### storeTermOffsets

    public boolean storeTermOffsets()

### omitNorms

    public boolean omitNorms()

### omitTf

    @Deprecated
    public boolean omitTf()

  Deprecated. Use `omitTermFreqAndPositions()`

### omitTermFreqAndPositions

    public boolean omitTermFreqAndPositions()

### omitPositions

    public boolean omitPositions()

### multiValued

    public boolean multiValued()

### sortMissingFirst

    public boolean sortMissingFirst()

### sortMissingLast

    public boolean sortMissingLast()

### isRequired

    public boolean isRequired()

### createField

    public Fieldable createField(String val,
                                 float boost)

### createFields

    public Fieldable[] createFields(String val,
                                    float boost)

### isPolyField

    public boolean isPolyField()

  If true, then use `createFields(String, float)`, else use `createField(java.lang.String, float)` to save an extra allocation

  Returns:
    true if this field is a poly field

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### write

    public void write(XMLWriter writer,
                      String name,
                      Fieldable val)
               throws IOException

  Throws:
    `IOException`

### write

    public void write(TextResponseWriter writer,
                      String name,
                      Fieldable val)
               throws IOException

  Throws:
    `IOException`

### getSortField

    public SortField getSortField(boolean top)

  Delegates to the FieldType for this field

  See Also:
    `FieldType.getSortField(org.apache.solr.schema.SchemaField, boolean)`

### 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

  Throws:
    `SolrException`
  See Also:
    `FieldType.getSortField(org.apache.solr.schema.SchemaField, boolean)`

### checkFieldCacheSource

    public void checkFieldCacheSource(QParser parser)
                               throws 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:
    `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`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD