Index
Search engine, Information retrieval
- Definition
- Make data available immediately that otherwise would require a scan.

This pattern collects documents, parses them and feeds the structured content into a data structure that is optimized for retrieval.
The purpose of storing an index is to optimize speed and performance in finding relevant documents for a search query. Without an index, the search engine would scan every document in the corpus, which would require considerable time and computing power.
Examples
- Search engines
When should you use it?
- If your user needs immediate access to information
Problems
- It can take a lot of space to index documents
How does it work?
Creates data structures that map keys to locations (e.g., trees, hashes) so lookups, range queries, and joins can be performed efficiently.