Add geo_distance proximity filter

Created on 13 January 2022, over 3 years ago
Updated 1 October 2025, 4 days ago

Problem/Motivation

Add geo_distance filter implementation : https://www.elastic.co/guide/en/elasticsearch/reference/6.8/query-dsl-ge...

Proposed resolution

Apply patch add-geo_distance.filter.patch
Use https://www.drupal.org/project/search_api_location for index geofield as latlon type.
Implement Implements hook_search_api_query_alter() and add custom condition :

$proximity = [
"distance" => "12km", // Distance on km
"latlon" => "[lat],[lon]"
];
$query->addCondition('[field_name]', $proximity, 'geo_distance');

Feature request
Status

Needs review

Component

Code

Created by

🇫🇷France hesslinger

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

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