Provide a mechanism for supporting search_api_location

Created on 14 November 2019, almost 5 years ago
Updated 19 September 2024, 9 days ago

Years ago I was building a geo-aware food discovery service. I toyed with JSON:API and Search API and wrote about it: https://glamanate.com/blog/using-json-api-query-your-search-api-indexes

It would be great to support search_api_location features.

Perhaps we support a specific filter key: geospatial

This filter is expected to be an array which accepts:

  • lat
  • lon
  • radius

This can then set the search_api_location option:

    $location_options[] = [
      'field' => 'latlon',
      'lat' => $latitude,
      'lon' => $longitude,
      'radius' => '8.04672',
    ];
    $query->setOption('search_api_location', $location_options);

The biggest question is determining the field. I cannot remember if latlon is always the field name used or if its dynamic.

✨ Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mglaman WI, USA

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024