Web / Apache Lucene Interview questions
What are Fields in a Lucene Document?
A Field is a named piece of data attached to a Document - for example title, body, or price. Each Field carries both a value and a FieldType that controls exactly how Lucene treats it.
The FieldType settings decide three independent things:
- Indexed - whether the value is analyzed and added to the inverted index so it's searchable.
- Stored - whether the original value is kept so it can be returned in search results.
- Tokenized - whether the value is split into terms (prose) or kept whole (an ID or SKU).
Because these three properties mix independently, the same piece of data can be made searchable-but-not-returned, returned-but-not-searchable, or both, depending on what the application actually needs.
More Related questions...