We should add "Ensure that destination is valid"-condition exact to the same condition.
So I added new condition group and added our conditions to it.
We couldn't add another parameter to opSimple() method because of
Warning: Declaration of Drupal\rg_location\Plugin\views\filter\GeofieldContainsFilter::opSimple($options, Drupal\Core\Database\Query\Condition $condition) should be compatible with
Drupal\geofield\Plugin\views\filter\GeofieldProximityFilter::opSimple($options)
So I rename method to opSimpleMethod().
Patch will be attached.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | geofield-proximity_filter_and_condition-3110969-13.patch | 788 bytes | itamair |
| #11 | screenshot.jpg | 247.02 KB | super_romeo |
Issue fork geofield-3110969
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3110969-proximity-filter-wrong
changes, plain diff MR !2
Comments
Comment #2
super_romeo commentedComment #3
super_romeo commentedComment #4
super_romeo commentedComment #5
super_romeo commentedComment #6
itamair commentedI don't see any need for this. The "Ensure that destination is valid" is already added to $this->query ...
Comment #7
super_romeo commentedSorry, but it's really important.
Conditions added with this filter should be in it's own condition group.
Consider I want to add
isPublishedfilter.Compare:
Wrong:
and
Correct:
It is like
2 + 2 * 2and(2 + 2) * 2.Comment #9
super_romeo commentedRerolled.
Comment #10
itamair commented@super_romeo I don't really understand your code, that is quite far to pass my code review.
It looks mostly un-effective to me. It seems you are refactoring some existing code, without improving it.
For instance at its end you are adding this:
$condition->where(geofield_haversine($options) . ' ' . $this->operator . ' ' . $this->value['value']);that is already added in the $this->query just the code row before.
And I also don't like you are adding and using this new 'opSimpleMethod' that is not present in the parent 'NumericFilter'.
But more than that I don' really understand which is the bug that you are trying to solve (may be my bad).
What is the bad outcome of what you call: "wrong condition operator if OR between view filters"?
Please, you clearly need to explain with details (and may be with @screehsots too) as I need really to understand, how to reproduce the use case that is not working for you with the actual code, and have evidence how your patch is solving it ...
Till I will assume that everything is working as expected, on this proximity filter side.
Comment #11
super_romeo commentedThis is the view with OR between filters:

This produces following SQL:
Take a look at
OR (("node__field_geo"."field_geo_lat" IS NOT NULL) AND (...ORshould beAND.Comment #12
itamair commentedComment #13
itamair commentedAh ok, Thanks ... now I got what you meant. Nice catch!
The much simpler attached patch is fixing this issue for me, in different filter combinations and groups.
Please review and report if you find any issue or regression with it.
I am going to commit shortly otherwise, and deploy a new Geofield 8.x release with it ...
PS: Let's keep an eye also to the Drupal patch naming conventions.
Comment #14
itamair commentedComment #16
itamair commentedFurther tested. Wrking fine. Committing into dev and new module release.
Comment #17
super_romeo commentedYou are welcome :)