org.apache.lucene.document
Class Field
- Fieldable, Serializable
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.
static class | Field.Index - Specifies whether and how a field should be indexed.
|
static class | Field.Store - Specifies whether and how a field should be stored.
|
static class | Field.TermVector - Specifies whether and how a field should have term vectors.
|
boost , fieldsData , isBinary , isCompressed , isIndexed , isStored , isTokenized , lazy , name , omitNorms , storeOffsetWithTermVector , storePositionWithTermVector , storeTermVector |
Field(String name, Reader reader) - Create a tokenized and indexed field that is not stored.
|
Field(String name, Reader reader, Field.TermVector termVector) - Create a tokenized and indexed field that is not stored, optionally with
storing term vectors.
|
Field(String name, String value, Field.Store store, Field.Index index) - Create a field by specifying its name, value and how it will
be saved in the index.
|
Field(String name, String value, Field.Store store, Field.Index index, Field.TermVector termVector) - Create a field by specifying its name, value and how it will
be saved in the index.
|
Field(String name, byte[] value, Field.Store store) - Create a stored field with binary value.
|
byte[] | binaryValue() - The value of the field in Binary, or null.
|
Reader | readerValue() - The value of the field as a Reader, or null.
|
String | stringValue() - The value of the field as a String, or null.
|
getBoost , getOmitNorms , isBinary , isCompressed , isIndexed , isLazy , isStoreOffsetWithTermVector , isStorePositionWithTermVector , isStored , isTermVectorStored , isTokenized , name , setBoost , setOmitNorms , setStoreTermVector , toString |
Field
public Field(String name,
Reader 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.
name
- The name of the fieldreader
- The reader with the content
Field
public Field(String name,
Reader reader,
Field.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.
name
- The name of the fieldreader
- The reader with the contenttermVector
- Whether term vector should be stored
Field
public Field(String name,
String value,
Field.Store store,
Field.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 fieldvalue
- The string to processstore
- Whether value
should be stored in the indexindex
- Whether the field should be indexed, and if so, if it should
be tokenized before indexing
Field
public Field(String name,
String value,
Field.Store store,
Field.Index index,
Field.TermVector termVector)
Create a field by specifying its name, value and how it will
be saved in the index.
name
- The name of the fieldvalue
- The string to processstore
- Whether value
should be stored in the indexindex
- Whether the field should be indexed, and if so, if it should
be tokenized before indexingtermVector
- Whether term vector should be stored
Field
public Field(String name,
byte[] value,
Field.Store store)
Create a stored field with binary value. Optionally the value may be compressed.
name
- The name of the fieldvalue
- The binary valuestore
- How value
should be stored (compressed or not)
binaryValue
public byte[] binaryValue()
The value of the field in Binary, or null. If null, the Reader or
String value is used. Exactly one of stringValue(), readerValue() and
binaryValue() must be set.
- binaryValue in interface Fieldable
readerValue
public Reader readerValue()
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 binaryValue() must be set.
- readerValue in interface Fieldable
stringValue
public String stringValue()
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
binaryValue() must be set.
- stringValue in interface Fieldable
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.