FieldSelector | Similar to a java.io.FileFilter , the FieldSelector allows one to make decisions about what Fields get loaded on a Document by org.apache.lucene.index.IndexReader#document(int,org.apache.lucene.document.FieldSelector) | code | html |
Fieldable | Synonymous with Field . | code | html |
AbstractField | code | html |
Field.Index | Specifies whether and how a field should be indexed. | code | html |
Field.Store | Specifies whether and how a field should be stored. | code | html |
Field.TermVector | Specifies whether and how a field should have term vectors. | code | html |
FieldSelectorResult | Provides information about what should be done with this Field | code | html |
CompressionTools | Simple utility class providing static methods to compress and decompress binary data for stored fields. | code | html |
DateField | Provides support for converting dates to strings and vice-versa. | code | html |
DateTools | Provides support for converting dates to strings and vice-versa. | code | html |
DateTools.Resolution | Specifies the time granularity. | code | html |
Document | Documents are the unit of indexing and search. | code | html |
Field | A field is a section of a Document. | code | html |
LoadFirstFieldSelector | Load the First field and break. | code | html |
MapFieldSelector | A FieldSelector based on a Map of field names to FieldSelectorResult s | code | html |
NumberTools | Provides support for converting longs to Strings, and back again. | code | html |
NumericField | This class provides a Field that enables indexing of numeric values for efficient range filtering and sorting. |
code | html |
SetBasedFieldSelector | Declare what fields to load normally and what fields to load lazily | code | html |
TestDocument | Tests Document class. | code | html |
The logical representation of a org.apache.lucene.document.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 org.apache.lucene.document.Document s and org.apache.lucene.document.Fieldable s.
A org.apache.lucene.document.Document is a collection of org.apache.lucene.document.Fieldable s. A org.apache.lucene.document.Fieldable is a logical representation of a user's content that needs to be indexed or stored. org.apache.lucene.document.Fieldable s have a number of properties that tell Lucene how to treat the content (like indexed, tokenized, stored, etc.) See the org.apache.lucene.document.Field implementation of org.apache.lucene.document.Fieldable for specifics on these properties.
Note: it is common to refer to org.apache.lucene.document.Document s having org.apache.lucene.document.Field s, even though technically they have org.apache.lucene.document.Fieldable s.
First and foremost, a org.apache.lucene.document.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 org.apache.lucene.document.Document . To see an example of this, take a look at the Lucene demo and the associated source code for extracting content from HTML.
The org.apache.lucene.document.DateTools is a utility class to make dates and times searchable (remember, Lucene only searches text). org.apache.lucene.document.NumericField is a special helper class to simplify indexing of numeric values (and also dates) for fast range range queries with org.apache.lucene.search.NumericRangeQuery (using a special sortable string representation of numeric values).
The org.apache.lucene.document.FieldSelector class provides a mechanism to tell Lucene how to load Documents from storage. If no FieldSelector is used, all Fieldables on a Document will be loaded. As an example of the FieldSelector usage, consider the common use case of displaying search results on a web page and then having users click through to see the full document. In this scenario, it is often the case that there are many small fields and one or two large fields (containing the contents of the original file). Before the FieldSelector, the full Document had to be loaded, including the large fields, in order to display the results. Now, using the FieldSelector, one can org.apache.lucene.document.FieldSelectorResult#LAZY_LOAD the large fields, thus only loading the large fields when a user clicks on the actual link to view the original content.