Web / Apache Lucene Interview questions
What is the difference between Stored fields and Indexed fields?
"Stored" and "indexed" are two independent switches on a Field, and confusing them is one of the more common Lucene mistakes.
| Indexed | Stored |
| Value is analyzed and added to the inverted index. | Original value is kept in a separate store for retrieval. |
| Makes the field searchable. | Makes the field returnable in results. |
| Doesn't preserve the exact original text (after analysis). | Preserves the exact original text. |
A field can be indexed-only (searchable but never shown back to the user, saving storage), stored-only (shown but never searched, like a thumbnail URL), or both. Choosing correctly per field is a direct lever on index size.
More Related questions...