Web / Apache Lucene Interview questions
What is a Term in Lucene?
A Term is the atomic unit the inverted index is built from - it's a pair of a field name and a text value, for example (content, "search"). The same word appearing in two different fields is two different Terms.
Every entry in the inverted index is keyed by a Term, and each Term points to a postings list of the documents (and often positions) where that exact field-plus-value pair occurs. Low-level query classes like TermQuery operate directly on a single Term.
Understanding Terms matters because it explains why title:lucene and body:lucene are treated as completely separate lookups internally, even though the text is identical.
More Related questions...