org.apache.lucene.document
Class Document

java.lang.Object
  |
  +--org.apache.lucene.document.Document

public final class Document
extends Object

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.
 Field getField(String name)
          Returns a field with the given name if any exist in this document, or null.
 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

Document

public Document()
Constructs a new document with no fields.
Method Detail

add

public final void add(Field field)
Adds a field to a document. Several fields may be added with the same name. In this case, if the fields are indexed, their text is treated as though appended for the purposes of search.

getField

public final Field getField(String name)
Returns a field with the given name if any exist in this document, or null. If multiple fields may exist with this name, this method returns the last added such added.

get

public final String get(String name)
Returns the string value of the field with the given name if any exist in this document, or null. If multiple fields may exist with this name, this method returns the last added such added.

fields

public final Enumeration fields()
Returns an Enumeration of all the fields in a document.

toString

public final String toString()
Prints the fields of a document for human consumption.
Overrides:
toString in class Object


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.