Structured parcel search with a fast LIMIT fetch and a capped count
Address lookup: send ONE address per call as {field: 'address', operator: 'like', value: '<street> <number>'} with maxResults 10 - values are trimmed, and street + house number matches the stored 'Bahnhofstrasse 1' form. Walk address lists in small sequential batches, not one wide parallel burst. Backs the choose app's parcel search (and the navbar EGRID search). Replaces the GeoServer WFS path, whose exact total count over broad filters took 7–30 s and blew the Vercel Edge 25 s wall. This endpoint splits the work: a LIMIT maxResults row fetch with NO ORDER BY (the client sorts; a stable order would force a full sort and defeat the early exit) and a separate count that stops at 10,001 rows, reported as numberMatched: 10000, capped: true (the count is skipped when the fetch returns fewer rows than maxResults - the total is then exact). like on address/streetname is a trigram-indexed contains match (fast); like on any other text column still scans.
Reads the configured parcel snapshot table (config.parcelTableName). Both statements run in one transaction under SET LOCAL statement_timeout = 20000; a filter that cannot use an index (notably like on fso_name_2021) trips it and answers 500 {"error":"parcel search failed"}.
Filtering rules live in ParcelSearchCondition: unknown fields and empty values are silently dropped rather than rejected, so a malformed condition list yields a broader search, never a 400. There is no request validation error path at all - the only non-200 answer is the 500.
No authentication (mirrors the WFS it replaced; the whole surface is public parcel data). Not cached.
https://res.aireon.ch/res_api/parcel_searchRequest body JSON required
Example requests
{
"conditions": [
{
"field": "fso_name_2021",
"operator": "eq",
"value": "Zürich"
},
{
"field": "cz_harmonized",
"operator": "like",
"value": "Wohn"
},
{
"field": "parcel_area",
"operator": "between",
"value": 1000,
"valueTo": 5000
}
],
"maxResults": 100
}{
"conditions": [
{
"field": "parcel_id",
"operator": "like",
"value": "CH513579227784"
}
],
"maxResults": 1
}Returns
200
GeoJSON-shaped FeatureCollection with geometry: null on every feature, plus the capped count.