Product search
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 11 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    How big is the index, and how many shards?

      How many search nodes when the sale opens?

        What does writing every price change into the index cost?

          How big and how busy is the live offer store?

            Build-up · 5 steps

            Build the high-level design

            One functional requirement at a time, ending with a design that works end to end for one region at moderate traffic.

            Step 1 of 5

            Search with free text

            Start simple. The search service matches the words across title, brand, category and attributes, title weighted highest, and BM25 picks the top 40. A nightly indexer rebuilds the index, so prices can be a day stale.

            6 interview moments

            You’re the candidate

            The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

            1. Deep dive 1 of 6

              Interviewer

              “Shoppers filter on colour and size, and want one card per product. What does one search document represent?”

              100 million offers, 20 million products. Index every offer and the black iPhone 15 appears 30 times, once per seller.

              Your move. Pick an approach:

            2. Deep dive 2 of 6

              Interviewer

              “Sale peak: 50,000 price and stock events a second, and 25 copies of every shard. How do prices stay fresh?”

              Your move. Pick an approach:

            3. Deep dive 3 of 6

              Interviewer

              “A shopper types “red runing shoes under 2000”. What should the engine actually search for?”

              Your move. Pick an approach:

            4. Deep dive 4 of 6

              Interviewer

              “For “iphone 15”, a ₹199 cover that repeats “iPhone 15” in its title outranks the phone. How do you rank?”

              Your move. Pick an approach:

            5. Deep dive 5 of 6

              Interviewer

              ““shoes” matches 3 million documents, and the page shows ten facets. How do you count them fast enough?”

              Your move. Pick an approach:

            6. Deep dive 6 of 6

              Interviewer

              “At midnight, searches jump from 20,000 to 200,000 a second in minutes. How does search stay up?”

              Your move. Pick an approach:

            Build-up · 8 steps

            Follow one search through it

            The read path is the gateway, the search service, the index and the live store. Every write arrives asynchronously through Kafka.

            Step 1 of 8

            Edge

            The gateway authenticates the shopper and applies per-client limits that stop scrapers before they reach search, then forwards to the search service.