| java.lang.Object org.apache.lucene.document.AbstractField org.apache.lucene.document.Field
Field | final public class Field extends AbstractField implements Fieldable,Serializable(Code) | | 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.
|
Constructor Summary | |
public | Field(String name, String value, Store store, Index index) Create a field by specifying its name, value and how it will
be saved in the index. | public | Field(String name, 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. | public | Field(String name, Reader reader) Create a tokenized and indexed field that is not stored. | public | Field(String name, Reader reader, TermVector termVector) Create a tokenized and indexed field that is not stored, optionally with
storing term vectors. | public | Field(String name, TokenStream tokenStream) Create a tokenized and indexed field that is not stored. | public | Field(String name, TokenStream tokenStream, TermVector termVector) Create a tokenized and indexed field that is not stored, optionally with
storing term vectors. | public | Field(String name, byte[] value, Store store) Create a stored field with binary value. |
Field | public Field(String name, String value, Store store, Index index)(Code) | | 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.
Parameters: name - The name of the field Parameters: value - The string to process Parameters: store - Whether value should be stored in the index Parameters: index - Whether the field should be indexed, and if so, if it shouldbe tokenized before indexing throws: NullPointerException - if name or value is null throws: IllegalArgumentException - if the field is neither stored nor indexed |
Field | public Field(String name, String value, Store store, Index index, TermVector termVector)(Code) | | Create a field by specifying its name, value and how it will
be saved in the index.
Parameters: name - The name of the field Parameters: value - The string to process Parameters: store - Whether value should be stored in the index Parameters: index - Whether the field should be indexed, and if so, if it shouldbe tokenized before indexing Parameters: termVector - Whether term vector should be stored throws: NullPointerException - if name or value is null throws: IllegalArgumentException - in any of the following situations: - the field is neither stored nor indexed
- the field is not indexed but termVector is
TermVector.YES |
Field | public Field(String name, Reader reader)(Code) | | 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.
Parameters: name - The name of the field Parameters: reader - The reader with the content throws: NullPointerException - if name or reader is null |
Field | public Field(String name, Reader reader, TermVector termVector)(Code) | | 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.
Parameters: name - The name of the field Parameters: reader - The reader with the content Parameters: termVector - Whether term vector should be stored throws: NullPointerException - if name or reader is null |
Field | public Field(String name, TokenStream tokenStream)(Code) | | 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.
Parameters: name - The name of the field Parameters: tokenStream - The TokenStream with the content throws: NullPointerException - if name or tokenStream is null |
Field | public Field(String name, TokenStream tokenStream, TermVector termVector)(Code) | | 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.
Parameters: name - The name of the field Parameters: tokenStream - The TokenStream with the content Parameters: termVector - Whether term vector should be stored throws: NullPointerException - if name or tokenStream is null |
Field | public Field(String name, byte[] value, Store store)(Code) | | Create a stored field with binary value. Optionally the value may be compressed.
Parameters: name - The name of the field Parameters: value - The binary value Parameters: store - How value should be stored (compressed or not) throws: IllegalArgumentException - if store is Store.NO |
binaryValue | public byte[] binaryValue()(Code) | | The value of the field in Binary, or null. If null, the Reader value,
String value, or TokenStream value is used. Exactly one of stringValue(),
readerValue(), binaryValue(), and tokenStreamValue() must be set.
|
readerValue | public Reader readerValue()(Code) | | The value of the field as a Reader, or null. If null, the String value,
binary value, or TokenStream value is used. Exactly one of stringValue(),
readerValue(), binaryValue(), and tokenStreamValue() must be set.
|
setValue | public void setValue(String value)(Code) | | 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.
Note that you should only use this method after the
Field has been consumed (ie, the
Document containing this Field has been added to the index).
Also, each Field instance should only be used once
within a single
Document instance. See ImproveIndexingSpeed
for details.
|
setValue | public void setValue(byte[] value)(Code) | | Expert: change the value of this field. See setValue(String).
|
stringValue | public String stringValue()(Code) | | The value of the field as a String, or null. If null, the Reader value,
binary value, or TokenStream value is used. Exactly one of stringValue(),
readerValue(), binaryValue(), and tokenStreamValue() must be set.
|
tokenStreamValue | public TokenStream tokenStreamValue()(Code) | | The value of the field as a TokesStream, or null. If null, the Reader value,
String value, or binary value is used. Exactly one of stringValue(),
readerValue(), binaryValue(), and tokenStreamValue() must be set.
|
|
|