# Overview of Inverted Index #flashcard
- A data structure that maps individual words to the documents that contain those words. This approach is often used to enable fast search of text fields. A standard index on a text field would not effectively capture substrings that contain the searched field.
- An inverted index uses [[tokenization]] and [[stemming]] to turn strings into a more searchable term. Then, the term is the key for the index. Each key (i.e., term) is then mapped to a list of documents that contain that term.
<!--ID: 1751507777670-->
## Diagram
![[Inverted Index 2024-09-17 11.32.24.excalidraw.svg]]
# Key Considerations
An inverted index is typically sorted in alphabetical order.
# Pros
# Cons
# Use Cases
## Prefix Searches
Since inverted indexes are in sorted order, it is simple to search for all terms that start with a certain prefix.
## Suffix Searches
Create a reversed version of the inverted index where all terms are in reverse order.
# Related Topics