Based on the preceding example, we can state the following:
- We need to have a quick lookup to determine if a word exists in our index
- For any given word, we need to have an efficient way to list all the books the word might be in
We can achieve these two niceties by using an inverted index. A standard index's mapping order is book → word → occurrence (page, line, and so on) as seen in the previous example. If we use an inverted index, the mapping order becomes word → book → occurrence (page, line, and so on).
This change might not seem to be of great significance; however, it improves the look up a lot. Let's look at it with another example.