Elliot Sawyer
03/14/2026, 1:54 AM[
'name' => 'suburbs',
'fields' => [
['name' => 'council.id', 'type' => 'int32'],
['name' => 'council.name', 'type' => 'string'],
['name' => 'city.id', 'type' => 'int32'],
['name' => 'city.name', 'type' => 'string'],
['name' => 'suburb.id', 'type' => 'int32'],
['name' => 'suburb.name', 'type' => 'string'],
['name' => 'polyline', 'type' => 'string'],
['name' => 'area', 'type' => 'geopolygon'],
],
'enable_nested_fields' => true
]
I'm adding a document that looks like this:
$doc = [
'id' => (string) $id,
'council.id' => $councilID,
'council.name' => $councilName,
'city.id' => $cityID,
'city.name' => $cityName,
'suburb.id' => $suburbID,
'suburb.name' => $suburbName,
'polyline' => $polyline,
'area' => $geo
];
My points are Google polylines, decoded and chunked, that look like this:
[
[-43.87303, 171.7223],
[-43.88554, 171.72586],
[-43.88888, 171.72705],
[-43.89761, 171.73431],
[-43.89957, 171.73657],
[-43.90029, 171.73747],
[-43.90204, 171.75693],
[-43.90173, 171.7583],
[-43.89736, 171.76499],
[-43.87886, 171.79079],
[-43.8779, 171.79082],
[-43.86122, 171.77881],
[-43.86052, 171.77765],
[-43.85319, 171.74691],
[-43.85222, 171.72776],
[-43.86604, 171.72113],
[-43.87303, 171.7223]
]
The documents all appear to emplace correctly: the total count of the collection matches the number I expect. But when I view the collection in the bfritscher dashboard, instantsearch doesn't load any results. The stats counter updates with hits, but the hits array in the results are empty. I'm unable to query * via SDK or CURL, and export returns ""
Removing the area field, the collection behaves in the way I expect. I haven't used the field before, so unsure if this is a bug or I'm just using it incorrectly.
Using Typesense 30.1 and v5.2.0 of PHP SDK.Elliot Sawyer
03/14/2026, 1:56 AMElliot Sawyer
03/14/2026, 2:05 AMElliot Sawyer
03/14/2026, 4:29 AMcurl 'https://localhost/_typesense/multi_search?x-typesense-api-key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--compressed \
-X POST \
-H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:148.0) Gecko/20100101 Firefox/148.0' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'Accept-Encoding: gzip, deflate, br, zstd' \
-H 'Content-Type: text/plain' \
-H 'Origin: http://localhost:28108' \
-H 'Connection: keep-alive' \
-H 'Referer: http://localhost:28108/' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: same-site' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' \
--data-raw '{"searches":[{"max_candidates":4,"query_by":"council.name,city.name,suburb.name,polyline","highlight_full_fields":"council.name,city.name,suburb.name,polyline","collection":"suburbs","q":"at","page":1,"per_page":12}]}'Max Priazhevskii
03/15/2026, 5:59 AM'area' => [0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0]
And then it’s possible to search for documents whose polygon area contains a specific point:
'q' => '*',
'filter_by' => 'area:(0.5, 0.5)',
We use this to geolocate a predefined region from a visitor’s geo coordinates, for example: AUK -> NI -> NZ. Hope it helps :)Elliot Sawyer
03/15/2026, 6:48 AMElliot Sawyer
03/15/2026, 6:50 AM[-43.87303, 171.7223, -43.88554, 171.72586, -43.88888, 171.72705, ..., -43.87303, 171.7223]. Basically the decoded polyline, without chunking it into lat/lon?Max Priazhevskii
03/15/2026, 6:55 AM