advancedTop 30 Scenario-Based Questions
How would you implement auto-complete search using Redis?
Redis Sorted Set for prefix search: 1) Indexing: for each product 'MacBook Pro', add all prefixes: ZADD autocomplete 0 'mac', 0 'macb', 0 'macbo', ... 0 'macbook pro', 0 'macbook pro#100' (terminator + productId). 2) Search: find prefix range: ZRANGEBYLEX autocomplete '[macb' '[macb\xff' LIMIT 0 5. 3) Returns: 'macbook', 'macbook pro#100' — extract full terms. 4) Better approach: Store prefix → li
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response