Zing generates search results in four phases
Generate search results by dividing documents among shards, searching shard documents, scoring shard documents, and merging scores into an index.
- Divide searchable documents among index shards.
- Search and filter shard documents.
- Score shard documents.
- Merge shard document scores into an index.
Phase 1: Divide searchable documents among index shards
When a search is executed, the system equally divides all searchable documents among 10 index shards. Each shard has a unique list of documents.
To maximize search efficiency, the system creates 10 query threads to simultaneously search each index shard.
Phase 2: Search and filter shard documents
wifi" and "network" in no particular order.The query thread assigns each matching document a numeric value (a document ID) to uniquely identify it. All other documents are ignored.
Phase 3: Score shard documents
The query thread scores each matching shard document.
Phase 4: Merge and sort shard document scores
The system merges the document scores into a single index and sorts the documents from highest to lowest document score. The documents with the highest document score are most relevant to the search query.