An inverted index maps searchable terms to the documents where they occur, allowing full-text search to retrieve matching content quickly instead of scanning every document. section 11.2 section 11.8
Apache Lucene builds this structure for full-text search. Before indexing, it tokenizes document content, can recognize multiword terms, and normalizes characters such as converting them to lowercase. Search results can then be ranked by relevance, with customization through boosting or score decay. section 11.2
Use an inverted index when search must go beyond exact database matching:
- Retrieve relevant documents quickly across large collections. section 11.0
- Support Boolean, fuzzy, wildcard, phrase, proximity, range, and faceted searches. section 11.0
- Rank matches by term frequency and collection-wide term commonness, then tune results with custom scoring. section 11.2
- Choose integrated Atlas Search when a separate search system would add synchronization, monitoring, and operational overhead. section 11.8
Inspection documents
For two inspection documents, the index associates tokens such as “BRONX,” “JERSEY CITY,” “NO VIOLATION ISSUED,” and “MOBILE FOOD VENDOR - 881” with the documents containing them. A query can therefore locate both records through shared terms and rank them by relevance. section 11.2
Table 11.1 Apache Lucene inverted index
| Token |
Document 1 |
Document 2 |
|
|
+ |
|
|
|
+ |
|
|
|
+ |
|
|
|
+ |
|
|
|
+ |
|
|
|
+ |
|
|
|
+ |
+ |
|
|
||
|
|
+ |
|
|
|
+ |
|
|
|
+ |
+ |
|
|
+ |
+ |
|
|
+ |
|
|
|
+ |
Browse the simplified Lucene inverted-index table linking inspection tokens to Documents 1 and 2. section 11.2




