Katkat

Design Map-Based Home Search

OpendoorBackend Engineer · Technical Screen

Last updated

This problem tests the ability to design a geo-spatial search service capable of handling high-frequency map interactions, filtering, and data consistency at scale.

Problem: Design a Map-Based Home Search Service

Design the backend for a real estate platform where users explore properties on an interactive map. When a user pans or zooms, the map updates to show listings within the visible rectangular boundary (bounding box).

Functional Requirements

  1. Search: Return properties within a given bounding box (min_lat, min_lon, max_lat, max_lon).
  2. Filtering: Support dynamic filters such as price range, number of bedrooms, and property type.
  3. Map Experience: The system must remain responsive during rapid panning and zooming.

Non-Functional Requirements

  1. Scale: Support 10,000 requests per second with sub-200ms latency.
  2. Freshness: Property updates (price changes, status updates) should be reflected on the map within seconds.
  3. Consistency: Users should see consistent results as they adjust map bounds.

Deliverables

  • API Contract: Define the request/response structure for the search endpoint.
  • Storage Strategy: Propose a database schema and indexing strategy for geographic data and listing attributes.
  • System Architecture: Describe how you would handle hot regions (e.g., highly popular cities) and provide efficient pagination.
  • Caching: Explain your strategy for caching geo-queries and how to invalidate stale results.

Hints

Hint 1

Consider using geohashes or Quadtrees to convert 2D map coordinates into a 1D index for efficient range queries.

Hint 2

Decouple the primary search query (filtering/spatial) from the detailed property metadata to allow for different caching strategies.

Hint 3

Think about how to handle 'hot spots' where thousands of users might be viewing the same popular neighborhood simultaneously.

Follow-up questions

  • How would you implement 'stable pagination' if a user is scrolling through a list while the underlying property data changes?
  • If the number of listings in a map view exceeds 10,000, how would you design a clustering service to represent them effectively?
  • How would you integrate a real-time event pipeline to ensure that a listing marked 'sold' disappears from the map globally within 5 seconds?