Skip to content
Navigation

Distinct localities, municipalities and locality→municipality aliases for autocomplete

Three sorted lists aggregated over the whole parcel snapshot, for client-side autocomplete (the matchoo app is the only consumer). locations is derived from cityname (address/GWR join → only parcels WITH a building, so a purely rural municipality never appears); municipalities is derived from the never-null fso_name_2021 and is the list that can reach a vacant plot; localityAliases translates a locality string a client may still hold (saved search, shared URL, geocoder result) into the municipality name(s) to filter fso_name_2021 with in.

Caching. The aggregate is three full-table scans (~7 s cold, ~12 s for all three), so the shaped payload is stored in Redis under parcel_locations:v2:<table> for 30 days (the snapshot table name is part of the key, so a snapshot swap never serves stale data; the monthly refresh should additionally deleteByPattern('parcel_locations:*')). A cold rebuild runs under a 90 s statement timeout with a stampede guard: concurrent cold callers share one in-flight query. Every 200 carries Cache-Control: public, max-age=3600 so the Vercel edge proxies re-cache it.

No authentication - same posture as POST /res_api/parcel_search.

GET
https://res.aireon.ch/res_api/parcel_search/locations

Returns

200

The three lists.

JSON
  • generatedAt
    string
    required

    When the cached payload was computed (up to 30 days ago).

    format: date-time
  • count
    integer
    required

    locations.length.

  • locations
    array of
    array<unknown>
    required

    One entry per distinct cityname, sorted ascending: [cityname, zips[], parcelCount].

  • municipalities
    array of
    array<unknown>
    required

    One entry per distinct fso_name_2021, sorted ascending: [fsoName, zips[], parcelCount]. zips is often empty (a building-less municipality has no address rows).

  • localityAliases
    array of
    array<unknown>
    required

    Only genuine aliases (a cityname that is NOT a municipality name), sorted ascending: [cityname, [fsoName, …]].

500

Aggregate failed (e.g. exceeded the 90 s cold-rebuild timeout) - {"error":"parcel locations failed"}.
JSON
  • error
    string
    required

    Human-readable error description.

  • message
    optional
    string

    Optional underlying error message.

Type to search…

↑↓ navigate↵ selectEsc close