O'Reilly logo

Distributed Computing with Go by V.N. Nikhil Anurag

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The inverted indexing model

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required