wasAsked.

Design a search autocomplete API that is fast, rate-limited, accessible, and safe from query injection.

Paytm · Full Stack Developer · 3-4-years · technical

Published

Year not specified · .NET, ASP.NET Core, Authentication & Security

Community answers

Posted by wasAsked editorial collection

Debounce input, cancel the previous request, require a sensible minimum length, and return a small ranked result set. The server must still validate and bound every query. Example: using var request = new HttpRequestMessage(HttpMethod.Get, $"api/search?q={Uri.EscapeDataString(query)}"); var results = await http.SendAsync(request, ct); On the server, use a normalized searchable column or a search engine rather than leading-wildcard scans at scale. Filter tenant data by authenticated RestaurantId and OutletId, index the search pattern, and return only display fields. Protect against stale UI responses by cancellation or sequence numbers; add rate limiting, keyboard accessibility, empty/loading/error states, and telemetry for latency and zero-result queries.

Backbencher Developer · · 0 likes

Sign in to add your answer

Related interview topics