Expand description
Inverted Index for Lexical Search (Task 4)
This module implements an inverted index for BM25-based lexical search.
§Structure
Term → PostingList
┌────────────────────────────────────────────────────────────────┐
│ "hello" → [(doc_1, tf=2, positions=[0,5]), (doc_3, tf=1, ...)]│
│ "world" → [(doc_1, tf=1, positions=[1]), (doc_2, tf=3, ...)] │
│ ... │
└────────────────────────────────────────────────────────────────┘§Query Execution
- Tokenize query
- Look up posting lists for each query term
- Score documents using BM25
- Return top-K results
Structs§
- Document
Info - Information about an indexed document
- Inverted
Index - Inverted index for lexical search
- Inverted
Index Builder - Builder for batch index construction
- Posting
- A posting for a single document
- Posting
List - A posting list for a term