Lucene.Net
3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
|
A field is a section of a Document. Each field has two parts, a name and a value. Values may be free text, provided as a String or as a Reader, or they may be atomic keywords, which are not further processed. Such keywords may be used to represent dates, urls, etc. Fields are optionally stored in the index, so that they may be returned with hits on the document. More...
Inherits Lucene.Net.Documents.AbstractField, and Lucene.Net.Documents.IFieldable.
Public Types | |
enum | Store { YES, NO } |
Specifies whether and how a field should be stored. More... | |
enum | Index { NO, ANALYZED, NOT_ANALYZED, NOT_ANALYZED_NO_NORMS, ANALYZED_NO_NORMS } |
Specifies whether and how a field should be indexed. More... | |
enum | TermVector { NO, YES, WITH_POSITIONS, WITH_OFFSETS, WITH_POSITIONS_OFFSETS } |
Specifies whether and how a field should have term vectors. More... | |
Public Member Functions | |
void | SetValue (System.String value) |
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. | |
void | SetValue (System.IO.TextReader value) |
Expert: change the value of this field. See setValue(String). | |
void | SetValue (byte[] value) |
Expert: change the value of this field. See setValue(String). | |
void | SetValue (byte[] value, int offset, int length) |
Expert: change the value of this field. See setValue(String). | |
void | SetTokenStream (TokenStream 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 stringValue() or GetBinaryValue() | |
Field (System.String name, System.String value, Store store, Index index) | |
Create a field by specifying its name, value and how it will be saved in the index. Term vectors will not be stored in the index. | |
Field (System.String name, System.String value, Store store, Index index, TermVector termVector) | |
Create a field by specifying its name, value and how it will be saved in the index. | |
Field (System.String name, bool internName, System.String value, Store store, Index index, TermVector termVector) | |
Create a field by specifying its name, value and how it will be saved in the index. | |
Field (System.String name, System.IO.TextReader reader) | |
Create a tokenized and indexed field that is not stored. Term vectors will not be stored. The Reader is read only when the Document is added to the index, i.e. you may not close the Reader until IndexWriter.AddDocument(Document) has been called. | |
Field (System.String name, System.IO.TextReader reader, TermVector termVector) | |
Create a tokenized and indexed field that is not stored, optionally with storing term vectors. The Reader is read only when the Document is added to the index, i.e. you may not close the Reader until IndexWriter.AddDocument(Document) has been called. | |
Field (System.String name, TokenStream 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 IndexWriter.AddDocument(Document) has been called. | |
Field (System.String name, TokenStream tokenStream, TermVector 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 IndexWriter.AddDocument(Document) has been called. | |
Field (System.String name, byte[] value_Renamed, Store store) | |
Create a stored field with binary value. Optionally the value may be compressed. | |
Field (System.String name, byte[] value_Renamed, int offset, int length, Store store) | |
Create a stored field with binary value. Optionally the value may be compressed. | |
Public Member Functions inherited from Lucene.Net.Documents.AbstractField | |
virtual byte[] | GetBinaryValue () |
Return the raw byte[] for the binary field. Note that you must also call BinaryLength and BinaryOffset to know which range of bytes in this returned array belong to the field. | |
virtual byte[] | GetBinaryValue (byte[] result) |
Return the raw byte[] for the binary field. Note that you must also call BinaryLength and BinaryOffset to know which range of bytes in this returned array belong to the field.About reuse: if you pass in the result byte[] and it is used, likely the underlying implementation will hold onto this byte[] and return it in future calls to GetBinaryValue() or GetBinaryValue(). So if you subsequently re-use the same byte[] elsewhere it will alter this Fieldable's value. | |
override System.String | ToString () |
Prints a Field for human consumption. | |
Properties | |
override string | StringValue [get] |
The value of the field as a String, or null. If null, the Reader value or binary value is used. Exactly one of stringValue(), readerValue(), and getBinaryValue() must be set. | |
override TextReader | ReaderValue [get] |
The value of the field as a Reader, or null. If null, the String value or binary value is used. Exactly one of stringValue(), readerValue(), and getBinaryValue() must be set. | |
override TokenStream | TokenStreamValue [get] |
The TokesStream for this field to be used when indexing, or null. If null, the Reader value or String value is analyzed to produce the indexed tokens. | |
Properties inherited from Lucene.Net.Documents.AbstractField | |
virtual float | Boost [get, set] |
Gets or sets the boost factor for hits for this field. | |
virtual string | Name [get] |
Returns the name of the field as an interned string. For example "date", "title", "body", ... | |
bool | IsStored [get] |
True iff the value of the field is to be stored in the index for return with search hits. It is an error for this to be true if a field is Reader-valued. | |
bool | IsIndexed [get] |
True iff the value of the field is to be indexed, so that it may be searched on. | |
bool | IsTokenized [get] |
True iff the value of the field should be tokenized as text prior to indexing. Un-tokenized fields are indexed as a single word and may not be Reader-valued. | |
bool | IsTermVectorStored [get] |
True iff the term or terms used to index this field are stored as a term vector, available from Lucene.Net.Index.IndexReader.GetTermFreqVector(int,String). These methods do not provide access to the original content of the field, only to terms used to index it. If the original content must be preserved, use the stored attribute instead. | |
virtual bool | IsStoreOffsetWithTermVector [get] |
True iff terms are stored as term vector together with their offsets (start and end position in source text). | |
virtual bool | IsStorePositionWithTermVector [get] |
True iff terms are stored as term vector together with their token positions. | |
bool | IsBinary [get] |
True iff the value of the filed is stored as binary | |
virtual int | BinaryLength [get] |
Returns length of byte[] segment that is used as value, if Field is not binary returned value is undefined | |
virtual int | BinaryOffset [get] |
Returns offset into byte[] segment that is used as value, if Field is not binary returned value is undefined | |
virtual bool | OmitNorms [get, set] |
True if norms are omitted for this indexed field | |
virtual bool | OmitTermFreqAndPositions [get, set] |
Expert: | |
virtual bool | IsLazy [get] |
abstract TokenStream | TokenStreamValue [get] |
abstract TextReader | ReaderValue [get] |
abstract string | StringValue [get] |
Properties inherited from Lucene.Net.Documents.IFieldable | |
float | Boost [get, set] |
Gets or sets the boost factor for hits for this field. This value will be multiplied into the score of all hits on this this field of this document. | |
string | Name [get] |
Returns the name of the field as an interned string. For example "date", "title", "body", ... | |
string | StringValue [get] |
The value of the field as a String, or null. For indexing, if isStored()==true, the stringValue() will be used as the stored field value unless isBinary()==true, in which case GetBinaryValue() will be used. | |
TextReader | ReaderValue [get] |
The value of the field as a Reader, which can be used at index time to generate indexed tokens. | |
TokenStream | TokenStreamValue [get] |
The TokenStream for this field to be used when indexing, or null. | |
bool | IsStored [get] |
True if the value of the field is to be stored in the index for return with search hits. | |
bool | IsIndexed [get] |
True if the value of the field is to be indexed, so that it may be searched on. | |
bool | IsTokenized [get] |
True if the value of the field should be tokenized as text prior to indexing. Un-tokenized fields are indexed as a single word and may not be Reader-valued. | |
bool | IsTermVectorStored [get] |
True if the term or terms used to index this field are stored as a term vector, available from Lucene.Net.Index.IndexReader.GetTermFreqVector(int,String). These methods do not provide access to the original content of the field, only to terms used to index it. If the original content must be preserved, use the stored attribute instead. | |
bool | IsStoreOffsetWithTermVector [get] |
True if terms are stored as term vector together with their offsets (start and end positon in source text). | |
bool | IsStorePositionWithTermVector [get] |
True if terms are stored as term vector together with their token positions. | |
bool | IsBinary [get] |
True if the value of the field is stored as binary | |
bool | OmitNorms [get, set] |
True if norms are omitted for this indexed field. | |
bool | IsLazy [get] |
Indicates whether a Field is Lazy or not. The semantics of Lazy loading are such that if a Field is lazily loaded, retrieving it's values via StringValue() or GetBinaryValue() is only valid as long as the Lucene.Net.Index.IndexReader that retrieved the Document is still open. | |
int | BinaryOffset [get] |
Returns offset into byte[] segment that is used as value, if Field is not binary returned value is undefined | |
int | BinaryLength [get] |
Returns length of byte[] segment that is used as value, if Field is not binary returned value is undefined | |
bool | OmitTermFreqAndPositions [get, set] |
A field is a section of a Document. Each field has two parts, a name and a value. Values may be free text, provided as a String or as a Reader, or they may be atomic keywords, which are not further processed. Such keywords may be used to represent dates, urls, etc. Fields are optionally stored in the index, so that they may be returned with hits on the document.
enum Lucene.Net.Documents.Field.Index |
Specifies whether and how a field should be indexed.
Enumerator | |
---|---|
NO |
Do not index the field value. This field can thus not be searched, but one can still access its contents provided it is stored. |
ANALYZED |
Index the tokens produced by running the field's value through an Analyzer. This is useful for common text. |
NOT_ANALYZED |
Index the field's value without using an Analyzer, so it can be searched. As no analyzer is used the value will be stored as a single term. This is useful for unique Ids like product numbers. |
NOT_ANALYZED_NO_NORMS |
Expert: Index the field's value without an Analyzer, and also disable the storing of norms. Note that you can also separately enable/disable norms by setting AbstractField.OmitNorms. No norms means that index-time field and document boosting and field length normalization are disabled. The benefit is less memory usage as norms take up one byte of RAM per indexed field for every document in the index, during searching. Note that once you index a given field with norms enabled, disabling norms will have no effect. In other words, for this to have the above described effect on a field, all instances of that field must be indexed with NOT_ANALYZED_NO_NORMS from the beginning. |
ANALYZED_NO_NORMS |
Expert: Index the tokens produced by running the field's value through an Analyzer, and also separately disable the storing of norms. See NOT_ANALYZED_NO_NORMS for what norms are and why you may want to disable them. |
enum Lucene.Net.Documents.Field.Store |
Specifies whether and how a field should be stored.
Enumerator | |
---|---|
YES |
Store the original field value in the index. This is useful for short texts like a document's title which should be displayed with the results. The value is stored in its original form, i.e. no analyzer is used before it is stored. |
NO |
Do not store the field value in the index. |
enum Lucene.Net.Documents.Field.TermVector |
Specifies whether and how a field should have term vectors.
Enumerator | |
---|---|
NO |
Do not store term vectors. |
YES |
Store the term vectors of each document. A term vector is a list of the document's terms and their number of occurrences in that document. |
WITH_POSITIONS |
Store the term vector + token position information
|
WITH_OFFSETS |
Store the term vector + Token offset information
|
WITH_POSITIONS_OFFSETS |
Store the term vector + Token position and offset information
|
Lucene.Net.Documents.Field.Field | ( | System.String | name, |
System.String | value, | ||
Store | store, | ||
Index | index | ||
) |
Create a field by specifying its name, value and how it will be saved in the index. Term vectors will not be stored in the index.
name | The name of the field |
value | The string to process |
store | Whether value should be stored in the index |
index | Whether the field should be indexed, and if so, if it should be tokenized before indexing |
<throws> NullPointerException if name or value is null
</throws> <throws> IllegalArgumentException if the field is neither stored nor indexed </throws>
Lucene.Net.Documents.Field.Field | ( | System.String | name, |
System.String | value, | ||
Store | store, | ||
Index | index, | ||
TermVector | termVector | ||
) |
Create a field by specifying its name, value and how it will be saved in the index.
name | The name of the field |
value | The string to process |
store | Whether value should be stored in the index |
index | Whether the field should be indexed, and if so, if it should be tokenized before indexing |
termVector | Whether term vector should be stored |
<throws> NullPointerException if name or value is null
</throws> <throws> IllegalArgumentException in any of the following situations: </throws>
TermVector.YES
Lucene.Net.Documents.Field.Field | ( | System.String | name, |
bool | internName, | ||
System.String | value, | ||
Store | store, | ||
Index | index, | ||
TermVector | termVector | ||
) |
Create a field by specifying its name, value and how it will be saved in the index.
name | The name of the field |
internName | Whether to .intern() name or not |
value | The string to process |
store | Whether value should be stored in the index |
index | Whether the field should be indexed, and if so, if it should be tokenized before indexing |
termVector | Whether term vector should be stored |
<throws> NullPointerException if name or value is null
</throws> <throws> IllegalArgumentException in any of the following situations: </throws>
TermVector.YES
Lucene.Net.Documents.Field.Field | ( | System.String | name, |
System.IO.TextReader | reader | ||
) |
Create a tokenized and indexed field that is not stored. Term vectors will not be stored. The Reader is read only when the Document is added to the index, i.e. you may not close the Reader until IndexWriter.AddDocument(Document) has been called.
name | The name of the field |
reader | The reader with the content |
<throws> NullPointerException if name or reader is null
</throws>
Lucene.Net.Documents.Field.Field | ( | System.String | name, |
System.IO.TextReader | reader, | ||
TermVector | termVector | ||
) |
Create a tokenized and indexed field that is not stored, optionally with storing term vectors. The Reader is read only when the Document is added to the index, i.e. you may not close the Reader until IndexWriter.AddDocument(Document) has been called.
name | The name of the field |
reader | The reader with the content |
termVector | Whether term vector should be stored |
<throws> NullPointerException if name or reader is null
</throws>
Lucene.Net.Documents.Field.Field | ( | System.String | name, |
TokenStream | 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 IndexWriter.AddDocument(Document) has been called.
name | The name of the field |
tokenStream | The TokenStream with the content |
<throws> NullPointerException if name or tokenStream is null
</throws>
Lucene.Net.Documents.Field.Field | ( | System.String | name, |
TokenStream | tokenStream, | ||
TermVector | 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 IndexWriter.AddDocument(Document) has been called.
name | The name of the field |
tokenStream | The TokenStream with the content |
termVector | Whether term vector should be stored |
<throws> NullPointerException if name or tokenStream is null
</throws>
Lucene.Net.Documents.Field.Field | ( | System.String | name, |
byte[] | value_Renamed, | ||
Store | store | ||
) |
Create a stored field with binary value. Optionally the value may be compressed.
name | The name of the field |
value_Renamed | The binary value |
store | How value should be stored (compressed or not) |
<throws> IllegalArgumentException if store is Store.NO
</throws>
Lucene.Net.Documents.Field.Field | ( | System.String | name, |
byte[] | value_Renamed, | ||
int | offset, | ||
int | length, | ||
Store | store | ||
) |
Create a stored field with binary value. Optionally the value may be compressed.
name | The name of the field |
value_Renamed | The binary value |
offset | Starting offset in value where this Field's bytes are |
length | Number of bytes to use for this Field, starting at offset |
store | How value should be stored (compressed or not) |
<throws> IllegalArgumentException if store is Store.NO
</throws>
void Lucene.Net.Documents.Field.SetTokenStream | ( | TokenStream | tokenStream | ) |
void Lucene.Net.Documents.Field.SetValue | ( | System.String | value | ) |
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.
void Lucene.Net.Documents.Field.SetValue | ( | System.IO.TextReader | value | ) |
Expert: change the value of this field. See setValue(String).
void Lucene.Net.Documents.Field.SetValue | ( | byte[] | value | ) |
Expert: change the value of this field. See setValue(String).
void Lucene.Net.Documents.Field.SetValue | ( | byte[] | value, |
int | offset, | ||
int | length | ||
) |
Expert: change the value of this field. See setValue(String).
|
get |
|
get |
|
get |