[scalability] Find all documents that contain a list of words

Given a list of millions of documents, how would you find all documents that contain a list of words? The words do not need to appear in any particular order, but they must be complete words, that is, "book" does not match "bookkeeper".

Solution:

Firstly, we need a hashtable to store a mapping from a word to a list of documents. But considering that there are millions of documents, maybe we cannot store the whole hashtable on one machine. We need to split the table into several parts. Like below, we use another higher level lookup table to tell us which machine stroes which part of the whole table.

[scalability] Find all documents that contain a list of words_第1张图片

你可能感兴趣的:(document)