NOTE
2.20 Inverted Index
A forward index maps document IDs to documents, while an inverted index maps terms to document IDs to find documents containing a given term.
This is a historical learning note and may contain outdated or incomplete understanding.
1. Forward Index
documentId -> document, such as MySQL
1.1. How to Find Documents Containing a Keyword
- Traverse all documents 【O(N)】
- Match character by character 【O(m+n)】
2. Inverted Index
keyword -> documentId + documentId -> document, such as ES
First tokenize the document, then record the mapping between tokens and document IDs, and also record the mapping between document IDs and documents.
2.1. How to Find Documents Containing a Keyword
- Traverse the tokens and retrieve the matching IDs 【O(N)】
- Retrieve the document by ID 【O(1)】
Drag to pan, scroll to zoom, and click a node to expand or collapse it. Large maps start with deeper levels collapsed; click nodes to expand them.
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub