Class Field
Expert: directly create a field for a document. Most users should use one of the sugar subclasses: Int32Field, Int64Field, SingleField, DoubleField, BinaryDocValuesField, NumericDocValuesField, SortedDocValuesField, StringField, TextField, StoredField.
A field is a section of a Document. Each field has three
parts: name, type and value. Values may be text
(
NOTE: the field type is an IIndexableFieldType. Making changes to the state of the IIndexableFieldType will impact any Field it is used in. It is strongly recommended that no changes be made after Field instantiation.
Inheritance
Assembly: DistributedLucene.Net.dll
Syntax
public class Field : object, IIndexableField
Constructors
Name | Description |
---|---|
Field(String, TokenStream) | Create a tokenized and indexed field that is not stored. Term vectors will
not be stored. This is useful for pre-analyzed fields.
The TokenStream is read only when the Document is added to the index,
i.e. you may not close the TokenStream until |
Field(String, TokenStream, Field.TermVector) | Create a tokenized and indexed field that is not stored, optionally with
storing term vectors. This is useful for pre-analyzed fields.
The TokenStream is read only when the Document is added to the index,
i.e. you may not close the TokenStream until |
Field(String, TokenStream, FieldType) | Create field with TokenStream value. |
Field(String, FieldType) | Expert: creates a field with no initial value. Intended only for custom Field subclasses. |
Field(String, BytesRef, FieldType) | Create field with binary value. NOTE: the provided BytesRef is not copied so be sure not to change it until you're done with this field. |
Field(String, Boolean) | |
Field(String, Byte[]) | Create a stored field with binary value. Optionally the value may be compressed. |
Field(String, Byte[], FieldType) | Create field with binary value. NOTE: the provided byte[] is not copied so be sure not to change it until you're done with this field. |
Field(String, Byte[], Int32, Int32) | Create a stored field with binary value. Optionally the value may be compressed. |
Field(String, Byte[], Int32, Int32, FieldType) | Create field with binary value. NOTE: the provided byte[] is not copied so be sure not to change it until you're done with this field. |
Field(String, String, Field.Store, Field.Index) | Create a field by specifying its |
Field(String, String, Field.Store, Field.Index, Field.TermVector) | Create a field by specifying its |
Field(String, String, FieldType) | Create field with |
Field(String, TextReader) | Create a tokenized and indexed field that is not stored. Term vectors will
not be stored. The |
Field(String, TextReader, Field.TermVector) | Create a tokenized and indexed field that is not stored, optionally with
storing term vectors. The |
Field(String, TextReader, FieldType) | Create field with |
Fields
Name | Description |
---|---|
m_boost | Field's boost |
m_name | Field's name |
m_tokenStream | Pre-analyzed TokenStream for indexed fields; this is
separate from FieldsData because you are allowed to
have both; eg maybe field has a |
m_type | Field's type |
Properties
Name | Description |
---|---|
Boost | Gets or sets the boost factor on this field. |
FieldsData | Field's value Setting this property will automatically set the backing field for the NumericType property. |
FieldType | |
IndexableFieldType | Returns the FieldType for this field as type IIndexableFieldType. |
Name | The field's name |
NumericType | Gets the NumericFieldType of the underlying value, or NONE if the value is not set or non-numeric. Expert: The difference between this property and NumericType is this is represents the current state of the field (whether being written or read) and the FieldType property represents instructions on how the field will be written, but does not re-populate when reading back from an index (it is write-only).
In Java, the numeric type was determined by checking the type of NOTE: Since Lucene codecs do not support BYTE or INT16, fields created with these types will always be INT32 when read back from the index. |
Methods
Name | Description |
---|---|
GetBinaryValue() | Non-null if this field has a binary value. |
GetByteValue() | Returns the field value as |
GetDoubleValue() | Returns the field value as |
GetInt16Value() | Returns the field value as |
GetInt32Value() | Returns the field value as |
GetInt64Value() | Returns the field value as |
GetNumericValue() | |
GetReaderValue() | The value of the field as a |
GetSingleValue() | Returns the field value as |
GetStringValue() | The value of the field as a |
GetStringValue(IFormatProvider) | The value of the field as a |
GetStringValue(String) | The value of the field as a |
GetStringValue(String, IFormatProvider) | The value of the field as a |
GetTokenStream(Analyzer) | |
GetTokenStreamValue() | The TokenStream for this field to be used when indexing, or |
SetBytesValue(BytesRef) | Expert: change the value of this field. See SetStringValue(String). NOTE: the provided BytesRef is not copied so be sure not to change it until you're done with this field. |
SetBytesValue(Byte[]) | Expert: change the value of this field. See SetStringValue(String). |
SetByteValue(Byte) | Expert: change the value of this field. See SetStringValue(String). |
SetDoubleValue(Double) | Expert: change the value of this field. See SetStringValue(String). |
SetInt16Value(Int16) | Expert: change the value of this field. See SetStringValue(String). |
SetInt32Value(Int32) | Expert: change the value of this field. See SetStringValue(String). |
SetInt64Value(Int64) | Expert: change the value of this field. See SetStringValue(String). |
SetReaderValue(TextReader) | Expert: change the value of this field. See SetStringValue(String). |
SetSingleValue(Single) | Expert: change the value of this field. See SetStringValue(String). |
SetStringValue(String) | Expert: change the value of this field. This can be used during indexing to re-use a single Field instance to improve indexing speed by avoiding GC cost of new'ing and reclaiming Field instances. Typically a single Document instance is re-used as well. This helps most on small documents. Each Field instance should only be used once within a single Document instance. See ImproveIndexingSpeed for details. |
SetTokenStream(TokenStream) | Expert: sets the token stream to be used for indexing and causes IsIndexed and IsTokenized to return true. May be combined with stored values from GetStringValue() or GetBinaryValue() |
ToString() | Prints a Field for human consumption. |
TranslateFieldType(Field.Store, Field.Index, Field.TermVector) | Translates the pre-4.0 enums for specifying how a field should be indexed into the 4.0 FieldType approach. |