Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
* Add an index with taxonomy references
* Add a view with "is empty" filter
The view has no results even when it should,
the query is broken: "IS NULL NULL".
Index: mcp_files
Keys: NULL
Conditions:
[
field_technologies IS NOT NULL NULL
AND
field_topics IS NULL NULL
AND
type <> NULL
]
Options: array (
'search_api_view' => 'object (Drupal\\views\\ViewExecutable)',
'search_api_base_path' => 'file-todo',
)
Comment | File | Size | Author |
---|---|---|---|
#5 | 2858303-5--views_taxonomy_filter_empty.patch | 1.72 KB | drunken monkey |
|
Comments
Comment #2
tavib47 CreditAttribution: tavib47 as a volunteer commentedHi,
I implemented the
opEmpty()
method ofSearchApiFilterTrait
to change the conditions fromIS NULL NULL
andIS NOT NULL NULL
to= NULL
and<> NULL
Comment #3
geek-merlinThanks for coding this, code makes sense. It will take some weeks though before i will work on this again and can test it.
Comment #5
drunken monkeyGreat catch, thanks a lot for reporting and fixing!
Your patch looks pretty good, but I think we can solve this even simpler, and more safely (in case code from anywhere else does this) – patch attached.
Also, however we fix this, it means we can remove the existing
opEmpty()
overrides for the numeric and date filters.Finally, it would be great to add a test for that to the
ViewsTest
. On the other hand, by removing the custom overrides for the numeric and date filters, we'll already have some testing there, so it's not too bad if we don't additionally test this for taxonomy term references, too.Comment #6
borisson_Looks good, I like removing code!
Comment #7
drunken monkeyThanks for reviewing!
Would be great, though, to also get a verification from beluoctavian or axel.rutz (or someone else experiencing this issue) that this indeed resolves the problem properly.
Comment #9
drunken monkeyWell, then I guess we'll just have to hope for the best.
Committed.
Thanks again, everyone!