When I configured Geofield as exposed filter (with Grouped settings) to display nodes by distance from a Person, every time I was submitting exposed form with the value changed for Distance filter, I wouldn't get any results back.
screenshot

So I started debugging to see where it fails, and I saw that the query condition being created is something like this for request DISTANCE <= 5 miles:
(( 3959 * ACOS( COS( RADIANS(26.629724) ) * COS( RADIANS(field_data_field_geo.field_geo_lat) ) * COS( RADIANS(field_data_field_geo.field_geo_lon) - RADIANS(-80.053181) ) + SIN( RADIANS(26.629724) ) * SIN( RADIANS(field_data_field_geo.field_geo_lat) ) ) ) = 5) ))

Basically, the query was built, but the Operator value for condition wasn't taken into account.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

veronicaSeveryn created an issue. See original summary.

veronicaSeveryn’s picture

Status: Active » Needs review
FileSize
795 bytes

Based on the Views views_handler_filter implementation, I figured that the Geofield handler is missing this piece of code where it checks for Grouped Filter operator settings:

if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id']) && isset($input[$this->options['expose']['operator_id']])) {
      $this->operator = $input[$this->options['expose']['operator_id']];
    }

So, I created a patch for Review.

jason@blaze’s picture

I ran into this problem today, and the patch seems to have resolved the issue.

+1