Design: Search Functionality System
Design covers search query processing, indexing, ranking, and autocomplete. Does not cover user authentication or data ingestion pipelines.
Functional Requirements
Non-Functional Requirements
Jump into concepts and practice - no test required
User | v Search API Server <--> Cache Layer <--> Search Index Storage | v Autocomplete Service | v Data Update Service --> Index Updater --> Search Index Storage
index = {}
keywords = ['apple', 'banana', 'apple']
docs = [1, 2, 3]
for i in range(len(keywords)):
index[keywords[i]] = docs[i]
print(index)
What is the bug in this code?