Skip to the guide

Nearby search: finding what's close

IntermediatePattern5 pages

Looking for a parking space near a theatre, you drive round the nearest streets first, read each space's sign ("permit holders only", "free after 6 pm"), and widen your loops if nothing fits. That works when most spaces are free to use. If you need a space with an electric charger, though, circling checks hundreds of spaces for the few that have one, so you open the city's short list of charging bays and pick the nearest.

You are the search service and the spaces are places. The streets round the theatre are map cells, driving round the block is reading the cells around the user, and a space's sign is a filter. The list of charging bays is an index on a rare attribute, the kind a search engine keeps for every word, and the city's parking map, updated when a car park opens, is the index fed by a change stream. Interviewers listen for where the index lives and what happens once the user adds a filter. The move: search the cells around the user in an in-memory index when most nearby places qualify, and use a search engine, which walks the shortest list, when few do.