Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm using Search Api Solr to do programatic searches with the following example code. How can I include a proximity search with this approach? I'm looking through the code but I'm not seeing it.
I'm using geofield and the latlng is being indexed correctly by solr and can make a direct filter with it, but need proximity.
Any help would be great!
Current code:
$index = search_api_index_load('solr_index');
$query = $index->query();
$query->keys('My search term');
$filter = $query->createFilter('OR');
$filter->condition('field_my_field', 'value');
$query->filter($filter);
$results = $query->execute();
Comments
Comment #2
drunken monkeySee
SearchApiViewsHandlerFilterLocation::query()
– you want something like the following:Comment #3
mrchristophy CreditAttribution: mrchristophy commentedIt works, thanks!