java.lang.Object | ||
↳ | org.apache.lucene.document.AbstractField | |
↳ | org.apache.lucene.document.Field |
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.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Field.Index | Specifies whether and how a field should be indexed. | ||||||||||
Field.Store | Specifies whether and how a field should be stored. | ||||||||||
Field.TermVector | Specifies whether and how a field should have term vectors. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.lucene.document.AbstractField
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a field by specifying its name, value and how it will
be saved in the index.
| |||||||||||
Create a field by specifying its name, value and how it will
be saved in the index.
| |||||||||||
Create a field by specifying its name, value and how it will
be saved in the index.
| |||||||||||
Create a tokenized and indexed field that is not stored.
| |||||||||||
Create a tokenized and indexed field that is not stored, optionally with
storing term vectors.
| |||||||||||
Create a tokenized and indexed field that is not stored.
| |||||||||||
Create a tokenized and indexed field that is not stored, optionally with
storing term vectors.
| |||||||||||
Create a stored field with binary value.
| |||||||||||
Create a stored field with binary value.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
The value of the field as a Reader, or null.
| |||||||||||
Expert: sets the token stream to be used for indexing and causes isIndexed() and isTokenized() to return true.
| |||||||||||
Expert: change the value of this field.
| |||||||||||
Expert: change the value of this field.
| |||||||||||
Expert: change the value of this field.
| |||||||||||
Expert: change the value of this field. | |||||||||||
The value of the field as a String, or null.
| |||||||||||
The TokesStream for this field to be used when indexing, or null.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.lucene.document.AbstractField
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.apache.lucene.document.Fieldable
|
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 |
NullPointerException | if name or value is null |
---|---|
IllegalArgumentException | if the field is neither stored nor indexed |
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 |
NullPointerException | if name or value is null |
---|---|
IllegalArgumentException | in any of the following situations:
|
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 |
NullPointerException | if name or value is null |
---|---|
IllegalArgumentException | in any of the following situations:
|
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 addDocument(Document)
has been called.
name | The name of the field |
---|---|
reader | The reader with the content |
NullPointerException | if name or reader is null
|
---|
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 addDocument(Document)
has been called.
name | The name of the field |
---|---|
reader | The reader with the content |
termVector | Whether term vector should be stored |
NullPointerException | if name or reader is null
|
---|
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 addDocument(Document)
has been called.
name | The name of the field |
---|---|
tokenStream | The TokenStream with the content |
NullPointerException | if name or tokenStream is null
|
---|
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 addDocument(Document)
has been called.
name | The name of the field |
---|---|
tokenStream | The TokenStream with the content |
termVector | Whether term vector should be stored |
NullPointerException | if name or tokenStream is null
|
---|
Create a stored field with binary value. Optionally the value may be compressed.
name | The name of the field |
---|---|
value | The binary value |
store | How value should be stored (compressed or not) |
IllegalArgumentException | if store is Store.NO
|
---|
Create a stored field with binary value. Optionally the value may be compressed.
name | The name of the field |
---|---|
value | 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) |
IllegalArgumentException | if store is Store.NO
|
---|
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.
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()
Expert: change the value of this field. See setValue(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.
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.
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.