Package org.apache.lucene.document
The logical representation of a Document
for indexing and searching.
The document package provides the user level logical representation of content to be indexed and searched. The
package also provides utilities for working with Document
s and IndexableField
s.
Document and IndexableField
A Document
is a collection of IndexableField
s. A
IndexableField
is a logical representation of a user's content that needs to be indexed or stored.
IndexableField
s have a number of properties that tell Lucene how to treat the content (like indexed, tokenized,
stored, etc.) See the Field
implementation of IndexableField
for specifics on these properties.
Note: it is common to refer to Document
s having Field
s, even though technically they have
IndexableField
s.
Working with Documents
First and foremost, a Document
is something created by the user application. It is your job
to create Documents based on the content of the files you are working with in your application (Word, txt, PDF, Excel or any other format.)
How this is done is completely up to you. That being said, there are many tools available in other projects that can make
the process of taking a file and converting it into a Lucene Document
.
The DateTools
is a utility class to make dates and times searchable
(remember, Lucene only searches text). IntField
, LongField
,
FloatField
and DoubleField
are a special helper class
to simplify indexing of numeric values (and also dates) for fast range range queries with NumericRangeQuery
(using a special sortable string representation of numeric values).
-
ClassDescriptionField that stores a per-document
BytesRef
value.Deprecated.Simple utility class providing static methods to compress and decompress binary data for stored fields.Provides support for converting dates to strings and vice-versa.Specifies the time granularity.Deprecated.UseBinaryDocValuesField
instead.Documents are the unit of indexing and search.AStoredFieldVisitor
that creates aDocument
containing all stored fields, or only specific requested fields provided toDocumentStoredFieldVisitor(Set)
.Syntactic sugar for encoding doubles as NumericDocValues viaDouble.doubleToRawLongBits(double)
.Field that indexesdouble
values for efficient range filtering and sorting.Expert: directly create a field for a document.Deprecated.This is here only to ease transition from the pre-4.0 APIs.Specifies whether and how a field should be stored.Deprecated.This is here only to ease transition from the pre-4.0 APIs.Describes the properties of a field.Data type of the numeric valueSyntactic sugar for encoding floats as NumericDocValues viaFloat.floatToRawIntBits(float)
.Field that indexesfloat
values for efficient range filtering and sorting.Deprecated.useNumericDocValuesField
instead.Field that indexesint
values for efficient range filtering and sorting.Deprecated.useNumericDocValuesField
instead.Field that indexeslong
values for efficient range filtering and sorting.Field that stores a per-documentlong
value for scoring, sorting or value retrieval.Deprecated.useNumericDocValuesField
instead.Deprecated.useNumericDocValuesField
instead.Deprecated.UseSortedDocValuesField
instead.Field that stores a per-documentBytesRef
value, indexed for sorting.Field that stores a set of per-documentBytesRef
values, indexed for faceting,grouping,joining.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.Deprecated.UseBinaryDocValuesField
instead.A field that is indexed but not tokenized: the entire String value is indexed as a single token.A field that is indexed and tokenized, without term vectors.
NumericDocValuesField
instead.