Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.lucene.document.Field
Nested Class Summary | |
static class |
|
static class |
|
static class |
|
Constructor Summary | |
| |
| |
| |
| |
| |
| |
|
Method Summary | |
static Field |
|
static Field |
|
static Field |
|
static Field |
|
static Field |
|
static Field |
|
static Field |
|
static Field |
|
static Field |
|
byte[] |
|
float |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
String |
|
Reader |
|
void |
|
void |
|
String |
|
String |
|
public Field(String name, Reader reader)
Create a tokenized and indexed field that is not stored. Term vectors will not be stored.
- Parameters:
name
- The name of the fieldreader
- The reader with the content
public Field(String name, Reader reader, Field.TermVector termVector)
Create a tokenized and indexed field that is not stored, optionally with storing term vectors.
- Parameters:
name
- The name of the fieldreader
- The reader with the contenttermVector
- Whether term vector should be stored
public Field(String name, String string, boolean store, boolean index, boolean token)
Deprecated. use
Field(String,String,Field.Store,Field.Index)
insteadCreate a field by specifying all parameters except forstoreTermVector
, which is set tofalse
.
public Field(String name, String string, boolean store, boolean index, boolean token, boolean storeTermVector)
Deprecated. use
Field(String,String,Field.Store,Field.Index,Field.TermVector)
instead
- Parameters:
name
- The name of the fieldstring
- The string to processstore
- true if the field should store the stringindex
- true if the field should be indexedtoken
- true if the field should be tokenizedstoreTermVector
- true if we should store the Term Vector info
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.
- Parameters:
name
- The name of the fieldvalue
- The string to processstore
- Whethervalue
should be stored in the indexindex
- Whether the field should be indexed, and if so, if it should be tokenized before indexing
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.
- Parameters:
name
- The name of the fieldvalue
- The string to processstore
- Whethervalue
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
public Field(String name, byte[] value, Field.Store store)
Create a stored field with binary value. Optionally the value may be compressed.
- Parameters:
name
- The name of the fieldvalue
- The binary valuestore
- Howvalue
should be stored (compressed or not)
public static final Field Keyword(String name, Date value)
Deprecated. use
Field(name, value, Field.Store.YES, Field.Index.UN_TOKENIZED)
insteadConstructs a Date-valued Field that is not tokenized and is indexed, and stored in the index, for return with hits.
public static final Field Keyword(String name, String value)
Deprecated. use
Field(name, value, Field.Store.YES, Field.Index.UN_TOKENIZED)
insteadConstructs a String-valued Field that is not tokenized, but is indexed and stored. Useful for non-text fields, e.g. date or url.
public static final Field Text(String name, Reader value)
Deprecated. use
Field(name, value)
insteadConstructs a Reader-valued Field that is tokenized and indexed, but is not stored in the index verbatim. Useful for longer text fields, like "body". Term vector will not be stored for this field.
public static final Field Text(String name, Reader value, boolean storeTermVector)
Deprecated. use
Field(name, value, storeTermVector)
insteadConstructs a Reader-valued Field that is tokenized and indexed, but is not stored in the index verbatim. Useful for longer text fields, like "body".
public static final Field Text(String name, String value)
Deprecated. use
Field(name, value, Field.Store.YES, Field.Index.TOKENIZED)
insteadConstructs a String-valued Field that is tokenized and indexed, and is stored in the index, for return with hits. Useful for short text fields, like "title" or "subject". Term vector will not be stored for this field.
public static final Field Text(String name, String value, boolean storeTermVector)
Deprecated. use
Field(name, value, Field.Store.YES, Field.Index.TOKENIZED, storeTermVector)
insteadConstructs a String-valued Field that is tokenized and indexed, and is stored in the index, for return with hits. Useful for short text fields, like "title" or "subject".
public static final Field UnIndexed(String name, String value)
Deprecated. use
Field(name, value, Field.Store.YES, Field.Index.NO)
insteadConstructs a String-valued Field that is not tokenized nor indexed, but is stored in the index, for return with hits.
public static final Field UnStored(String name, String value)
Deprecated. use
Field(name, value, Field.Store.NO, Field.Index.TOKENIZED)
insteadConstructs a String-valued Field that is tokenized and indexed, but that is not stored in the index. Term vector will not be stored for this field.
public static final Field UnStored(String name, String value, boolean storeTermVector)
Deprecated. use
Field(name, value, Field.Store.NO, Field.Index.TOKENIZED, storeTermVector)
insteadConstructs a String-valued Field that is tokenized and indexed, but that is not stored in the index.
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.
public float getBoost()
Returns the boost factor for hits for this field. The default value is 1.0. Note: this value is not stored directly with the document in the index. Documents returned fromIndexReader.document(int)
andHits.doc(int)
may thus not have the same value present as when this field was indexed.
- See Also:
setBoost(float)
public boolean getOmitNorms()
True if norms are omitted for this indexed field
public final boolean isBinary()
True iff the value of the filed is stored as binary
public final boolean isCompressed()
True if the value of the field is stored and compressed within the index
public final boolean isIndexed()
True iff the value of the field is to be indexed, so that it may be searched on.
public boolean isStoreOffsetWithTermVector()
True iff terms are stored as term vector together with their offsets (start and end positon in source text).
public boolean isStorePositionWithTermVector()
True iff terms are stored as term vector together with their token positions.
public final boolean isStored()
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.
public final boolean isTermVectorStored()
True iff the term or terms used to index this field are stored as a term vector, available fromIndexReader.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 thestored
attribute instead.
public final boolean isTokenized()
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.
public String name()
Returns the name of the field as an interned string. For example "date", "title", "body", ...
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.
public void setBoost(float boost)
Sets the boost factor hits on this field. This value will be multiplied into the score of all hits on this this field of this document. The boost is multiplied byDocument.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 valueSimilarity.lengthNorm(String,int)
, and rounded bySimilarity.encodeNorm(float)
before it is stored in the index. One should attempt to ensure that this product does not overflow the range of that encoding.
public void setOmitNorms(boolean omitNorms)
Expert: If set, omit normalization factors associated with this indexed field. This effectively disables indexing boosts and length normalization for this field.
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.
public final String toString()
Prints a Field for human consumption.