|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.document.Document
Documents are the unit of indexing and search. A Document is a set of fields. Each field has a name and a textual value. A field may be stored with the document, in which case it is returned with search hits on the document. Thus each document should typically contain stored fields which uniquely identify it.
Constructor Summary | |
Document()
Constructs a new document with no fields. |
Method Summary | |
void |
add(Field field)
Adds a field to a document. |
Enumeration |
fields()
Returns an Enumeration of all the fields in a document. |
String |
get(String name)
Returns the string value of the field with the given name if any exist in this document, or null. |
float |
getBoost()
Returns the boost factor for hits on any field of this document. |
Field |
getField(String name)
Returns a field with the given name if any exist in this document, or null. |
Field[] |
getFields(String name)
Returns an array of Field s with the given name. |
String[] |
getValues(String name)
Returns an array of values of the field specified as the method parameter. |
void |
setBoost(float boost)
Sets a boost factor for hits on any field of this document. |
String |
toString()
Prints the fields of a document for human consumption. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Document()
Method Detail |
public void setBoost(float boost)
Values are multiplied into the value of Field.getBoost()
of
each field in this document. Thus, this method in effect sets a default
boost for the fields of this document.
Field.setBoost(float)
public float getBoost()
The default value is 1.0.
Note: This value is not stored directly with the document in the index.
Documents returned from IndexReader.document(int)
and
Hits.doc(int)
may thus not have the same value present as when
this document was indexed.
setBoost(float)
public final void add(Field field)
public final Field getField(String name)
public final String get(String name)
public final Enumeration fields()
public final Field[] getFields(String name)
Field
s with the given name.
This method can return null
.
name
- the name of the field
Field[]
arraypublic final String[] getValues(String name)
null
.
UnStored fields' values cannot be returned by this method.
name
- the name of the field
String[]
of field valuespublic final String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |