Problem/Motivation
The filter concatenation is hard‑coded to use only 'and'. In some cases you should be able to use the other filters that are used in the Drupal view.
Steps to reproduce
Proposed resolution
Improve filter concatentation with filter groups.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | Screenshot 2026-05-26 at 4.23.16 PM.png | 23.25 KB | jacobsaw |
| #11 | Screenshot 2026-05-26 at 4.21.07 PM.png | 7.9 KB | jacobsaw |
| Improve_filter_concatenation.patch | 7.09 KB | krisp |
Issue fork search_api_aais-3561181
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:
Comments
Comment #3
krisp commentedComment #4
krisp commentedComment #7
jacobsaw commentedHello, I ran into a similar problem and tried your patch. Unfortunately, I was just getting back empty parenthesis with conjunctions ( and (or) and ). I've added another approach modeled on how search api solr creates their filter string but happy to consolidate/collaborate going forward, just needed something to clear this on my end for now.
Comment #8
krisp commentedYes, that's correct. The suggester als needed to change in order to use the filtergroups.
This was done in https://www.drupal.org/project/search_api_aais/issues/3561180
Comment #10
rinus van linden commentedComment #11
jacobsaw commentedHi Rinus,
Thanks for taking this issue on! I am another maintainer on the project and wanted to coordinate on the approach for this.
I have a use case where I have multiple nested conditions and that currently only functions with branch 3561181-recursive-filters, a method I adapted from Search API Solr. I attached two screenshots to demonstrate this (with 3561181-improve-filter-concatenation applied).
Separately, I also found a case where the negation operator we currently have does not cover all cases. Including that below this message as well.
If the current approach solves problems you and krisp have in the near term, happy for it to go forward, but just wanted to give you a heads up that I was planning on refactoring further to support that negation case and nested conditions in the next release as well.
Happy to discuss further, I am adam.w.jacobs on Drupal slack in case that helps.
Negation update:
- $negation = $condition->getOperator() === 'NOT IN' ? 'not ' : '';
+ $negation = $condition->getOperator() === 'NOT IN' || $condition->getOperator() === '<>' ? 'not ' : '';
Comment #12
rinus van linden commentedHi Jacob
I've ask Krisp to add the $negation update.
The filters should be recursive right now, could you share your multiple nested filters that don't work on this branch so i could test this as well.
For now i would like to move and close this merge request after the requested changes are done because the new issue that opened yesterday https://www.drupal.org/project/search_api_aais/issues/3592233 also affects the filter groups.
We can then see if those problems also remain for that issue with the added functionality and we'll make a release once all cases around the filter groups are fixed.
Happy to hear your thoughts on this and if there is something i can do let me know!
Comment #13
jacobsaw commentedThanks for getting back to me, Rinus!
Glad to see the negation operator included.
As I mentioned, happy for this merge to move forward, more just wanted to let you know there might be additional changes coming related to this class.
The new issue is actually more directly related to my case and I started testing it yesterday, so I am going to go ahead and assign myself to that one.
What would be great is if you and/or krisp can test the change from that new issue when it is ready and confirm it still covers what was solved here.
Comment #15
jacobsaw commentedComment #16
jacobsaw commentedHi Rinus and Krisp,
Please test again with the changes from https://www.drupal.org/project/search_api_aais/issues/3592233. This issue might also be resolved now.
I went ahead and merged the changes from that issue as it seemed to solve the same problems identified here, worked with nested conditions, and seemed pretty simple.
Comment #19
rinus van linden commentedComment #21
rinus van linden commented