public interface Document extends Closeable
Instance of this class represent a single document. Documents provide access to possibly several fields, which represent units of information that should be indexed separately.
Each field is accessible by a call to
content(int). Note, however, that unless specified
otherwise field content must be accessed in increasing order. You can skip some field,
but the contract of this class does not require that you can access fields in random order (although implementations
may provide this feature). Moreover, the data provided by a call to
content(int) (e.g., a
TEXT fields) may become invalid
at the next call (similarly to the behaviour of
The same holds for
After obtaining a document, it is your responsibility to close it.
It is advisable, although not strictly required, that documents have
toString() equal to their title.
|Modifier and Type||Method and Description|
Closes this document, releasing all resources.
Returns the content of the given field.
The title of this document.
A URI that is associated with this document.
Returns a word reader for the given
Object content(int field) throws IOException
WordReader wordReader(int field)
field- the field index.
void close() throws IOException
You should always call this method after manipulating a document. Implementations
are invited to call this method in a finaliser as a safety net (even better,
SafelyCloseable), but since there
is no guarantee as to when finalisers are invoked, you should not depend on this behaviour.