Package org.apache.lucene.document
Class StoredField
- java.lang.Object
-
- org.apache.lucene.document.Field
-
- org.apache.lucene.document.StoredField
-
- All Implemented Interfaces:
IndexableField
public final class StoredField extends Field
A field whose value is stored so thatIndexSearcher.doc(int)
andIndexReader.document(int, org.apache.lucene.index.StoredFieldVisitor)
will return the field and its value.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.document.Field
Field.Index, Field.Store, Field.TermVector
-
-
Constructor Summary
Constructors Constructor Description StoredField(java.lang.String name, byte[] value)
Create a stored-only field with the given binary value.StoredField(java.lang.String name, byte[] value, int offset, int length)
Create a stored-only field with the given binary value.StoredField(java.lang.String name, double value)
Create a stored-only field with the given double value.StoredField(java.lang.String name, float value)
Create a stored-only field with the given float value.StoredField(java.lang.String name, int value)
Create a stored-only field with the given integer value.StoredField(java.lang.String name, long value)
Create a stored-only field with the given long value.StoredField(java.lang.String name, java.lang.String value)
Create a stored-only field with the given string value.StoredField(java.lang.String name, BytesRef value)
Create a stored-only field with the given binary value.
-
Method Summary
-
Methods inherited from class org.apache.lucene.document.Field
binaryValue, boost, fieldType, name, numericValue, readerValue, setBoost, setBytesValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, stringValue, tokenStream, tokenStreamValue, toString, translateFieldType
-
-
-
-
Field Detail
-
TYPE
public static final FieldType TYPE
Type for a stored-only field.
-
-
Constructor Detail
-
StoredField
public StoredField(java.lang.String name, byte[] value)
Create a stored-only field with the given binary value.NOTE: the provided byte[] is not copied so be sure not to change it until you're done with this field.
- Parameters:
name
- field namevalue
- byte array pointing to binary content (not copied)- Throws:
java.lang.IllegalArgumentException
- if the field name is null.
-
StoredField
public StoredField(java.lang.String name, byte[] value, int offset, int length)
Create a stored-only field with the given binary value.NOTE: the provided byte[] is not copied so be sure not to change it until you're done with this field.
- Parameters:
name
- field namevalue
- byte array pointing to binary content (not copied)offset
- starting position of the byte arraylength
- valid length of the byte array- Throws:
java.lang.IllegalArgumentException
- if the field name is null.
-
StoredField
public StoredField(java.lang.String name, BytesRef value)
Create a stored-only field with the given binary value.NOTE: the provided BytesRef is not copied so be sure not to change it until you're done with this field.
- Parameters:
name
- field namevalue
- BytesRef pointing to binary content (not copied)- Throws:
java.lang.IllegalArgumentException
- if the field name is null.
-
StoredField
public StoredField(java.lang.String name, java.lang.String value)
Create a stored-only field with the given string value.- Parameters:
name
- field namevalue
- string value- Throws:
java.lang.IllegalArgumentException
- if the field name or value is null.
-
StoredField
public StoredField(java.lang.String name, int value)
Create a stored-only field with the given integer value.- Parameters:
name
- field namevalue
- integer value- Throws:
java.lang.IllegalArgumentException
- if the field name is null.
-
StoredField
public StoredField(java.lang.String name, float value)
Create a stored-only field with the given float value.- Parameters:
name
- field namevalue
- float value- Throws:
java.lang.IllegalArgumentException
- if the field name is null.
-
StoredField
public StoredField(java.lang.String name, long value)
Create a stored-only field with the given long value.- Parameters:
name
- field namevalue
- long value- Throws:
java.lang.IllegalArgumentException
- if the field name is null.
-
StoredField
public StoredField(java.lang.String name, double value)
Create a stored-only field with the given double value.- Parameters:
name
- field namevalue
- double value- Throws:
java.lang.IllegalArgumentException
- if the field name is null.
-
-