In order to get queries using the geofilt distance filter there are parameters that need to be passed in one fq attribute wrapped in {}. Attached is a patch to rebuild_fq to allow the facets array to contain an array, and if so treat each each item in it as a parameter to the fq. It is known to work with geofilt, I'm unsure of other use cases but I would assume it would function for them as well.

The code used to add the appropriate filter is as follows:

$this->query->add_filter('!geofilt', array(
  'pt' => $postal_information->latitude . ',' . $postal_information->longitude, 
  'sfield' => 'loclatlong', 
  'd' => $this->options['distance']));
}

Where pt is the attribute for the point (lat/long), sfield is the field that is document field of the type solr.LatLonType and d is the distance from the searched point in km.

CommentFileSizeAuthor
apachesolr_views_filter_array.patch905 byteswwhurley

Comments

kenorb’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Version 6.x is no longer supported due to Drupal 6 End of Life. For Drupal 8.x, use Search API Solr Searchinstead.