search_api_elasticsearch icon indicating copy to clipboard operation
search_api_elasticsearch copied to clipboard

search_api + elasticsearch + location_cck spatial indexing working

Open woutersf opened this issue 8 years ago • 3 comments

Related drupal.org issue: https://www.drupal.org/node/2804437

My Drupal 7 use case (and what problem does this fix): I have a content-type (e.g. Organisation) with a location Field (e.g.field_organisation_location - location_cck).

I want the organisations sorted by distance and filtered on a 5 km range close to a location (in my case this is a custom elastic query).

This pull request allows the cck_location field to be indexed and filtered/sorted spatially. The patch allows to

  • select all the location fields (street/latlon/...) in the search_api index
  • index this location data spatially
  • search on all location subfields in the index

Custom queries already work with sorting/filtering by location/distance (which is nice). I know this code is not perfect, but the latlong from location_cck is indexed in elasticsearch.

By the way: I am looking for advice on how to use these location data for filtering and sorting in views.

woutersf avatar Sep 22 '16 10:09 woutersf

I also don't understand why the Travis CI gives all these errors. Help is more than welcome.

woutersf avatar Sep 22 '16 10:09 woutersf

When the search_api_location FILTER (distance + radius) is enabled this will now also be passed on to the elastica query (see last commit) . Also when the lat lon is used as SORT they will be sorted from near to far.

//todo add view handler that allows "far to near/near to far" selection in views widget.

woutersf avatar Sep 22 '16 12:09 woutersf

@VeggieMeat can you please advise me on how to make the continuous build succeed? How do I impact this?

woutersf avatar Sep 23 '16 09:09 woutersf