org.apache.lucene.document
public final class Field extends Object implements Serializable
Nested Class Summary | |
---|---|
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. |
Constructor Summary | |
---|---|
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, 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 string, boolean store, boolean index, boolean token) Create a field by specifying all parameters except for storeTermVector ,
which is set to false .
| |
Field(String name, byte[] value, Field.Store store)
Create a stored field with binary value. | |
Field(String name, String string, boolean store, boolean index, boolean token, boolean storeTermVector) |
Method Summary | |
---|---|
byte[] | binaryValue() The value of the field in Binary, or null. |
float | getBoost() Returns the boost factor for hits for this field.
|
boolean | getOmitNorms() True if norms are omitted for this indexed field |
boolean | isBinary() True iff the value of the filed is stored as binary |
boolean | isCompressed() True if the value of the field is stored and compressed within the index |
boolean | isIndexed() True iff the value of the field is to be indexed, so that it may be
searched on. |
boolean | isStored() True iff the value of the field is to be stored in the index for return
with search hits. |
boolean | isStoreOffsetWithTermVector()
True iff terms are stored as term vector together with their offsets
(start and end positon in source text). |
boolean | isStorePositionWithTermVector()
True iff terms are stored as term vector together with their token positions. |
boolean | isTermVectorStored() True iff the term or terms used to index this field are stored as a term
vector, available from IndexReader.
|
boolean | isTokenized() True iff the value of the field should be tokenized as text prior to
indexing. |
static Field | Keyword(String name, String value) Constructs a String-valued Field that is not tokenized, but is indexed
and stored. |
static Field | Keyword(String name, Date value) Constructs a Date-valued Field that is not tokenized and is indexed,
and stored in the index, for return with hits. |
String | name() Returns the name of the field as an interned string.
|
Reader | readerValue() The value of the field as a Reader, or null. |
void | setBoost(float boost) Sets the boost factor hits on this field. |
void | setOmitNorms(boolean omitNorms) Expert:
If set, omit normalization factors associated with this indexed field.
|
String | stringValue() The value of the field as a String, or null. |
String | toString() Prints a Field for human consumption. |
static Field | Text(String name, String value) Constructs a String-valued Field that is tokenized and indexed,
and is stored in the index, for return with hits. |
static Field | Text(String name, String value, boolean storeTermVector) Constructs a String-valued Field that is tokenized and indexed,
and is stored in the index, for return with hits. |
static Field | Text(String name, Reader value) Constructs a Reader-valued Field that is tokenized and indexed, but is
not stored in the index verbatim. |
static Field | Text(String name, Reader value, boolean storeTermVector) Constructs a Reader-valued Field that is tokenized and indexed, but is
not stored in the index verbatim. |
static Field | UnIndexed(String name, String value) Constructs a String-valued Field that is not tokenized nor indexed,
but is stored in the index, for return with hits. |
static Field | UnStored(String name, String value) Constructs a String-valued Field that is tokenized and indexed,
but that is not stored in the index. |
static Field | UnStored(String name, String value, boolean storeTermVector) Constructs a String-valued Field that is tokenized and indexed,
but that is not stored in the index. |
Parameters: 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
IllegalArgumentException if the field is neither stored nor indexed
Parameters: 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
IllegalArgumentException in any of the following situations:
TermVector.YES
Parameters: name The name of the field reader The reader with the content
Throws: NullPointerException if name or reader is null
Parameters: 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
Deprecated: use Field instead
Create a field by specifying all parameters except forstoreTermVector
,
which is set to false
.
Parameters: name The name of the field value The binary value store How value
should be stored (compressed or not)
Throws: IllegalArgumentException if store is Store.NO
Deprecated: use Field instead
Parameters: name The name of the field string The string to process store true if the field should store the string index true if the field should be indexed token true if the field should be tokenized storeTermVector true if we should store the Term Vector info
The default value is 1.0.
Note: this value is not stored directly with the document in the index. Documents returned from IndexReader and Hits may thus not have the same value present as when this field was indexed.
See Also: Field
stored
attribute instead.
See Also: IndexReader
Deprecated: use
Field(name, value, Field.Store.YES, Field.Index.UN_TOKENIZED)
instead
Deprecated: use
Field(name, value, Field.Store.YES, Field.Index.UN_TOKENIZED)
instead
The boost is multiplied by getBoost of the document containing this field. If a document has multiple fields with the same name, all such values are multiplied together. This product is then multipled by the value Similarity, and rounded by Similarity before it is stored in the index. One should attempt to ensure that this product does not overflow the range of that encoding.
See Also: Document Similarity Similarity
Deprecated: use
Field(name, value, Field.Store.YES, Field.Index.TOKENIZED)
instead
Deprecated: use
Field(name, value, Field.Store.YES, Field.Index.TOKENIZED, storeTermVector)
instead
Deprecated: use Field(name, value)
instead
Deprecated: use
Field(name, value, storeTermVector)
instead
Deprecated: use
Field(name, value, Field.Store.YES, Field.Index.NO)
instead
Deprecated: use
Field(name, value, Field.Store.NO, Field.Index.TOKENIZED)
instead
Deprecated: use
Field(name, value, Field.Store.NO, Field.Index.TOKENIZED, storeTermVector)
instead