If you filter for "field_a = 1 OR field_b =2" where a and b are non required multivalued (list) fields and you have a content with 2 in field_b but no value for field_a that content is not returned from search_api_db because of the use of innerJoin.
Moving from innerJoin to leftJoin fixes this issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 2007872-1--missing_results_multi-valued_leftJoin.patch | 1002 bytes | drunken monkey |
Comments
Comment #1
drunken monkeyThanks for reporting!
Thinking about it, it's clear that this issue will pop up in the situation you describe, and I also could reproduce it. I think I had this discussion already once and I feared that just switching to
LEFT JOINwould break other things in unexpected places.However, trying it out, everything seems to keep working and (along with #1863672-6: Multiple content in the search result, when using multiple terms to filtering) the bug seems to be fixed. Please test out the attached patch to see if it also works for your use case!
(By the way, I think this will also occur for single-valued optional fields.)
Comment #2
francoud commentedSeems that this patch also solves a problem that I had using Views search api integration, when sorting by a field that not all content types had.
https://drupal.org/node/2010084Comment #3
bago commentedpatch in #1 works for me.
Comment #4
drunken monkeyExcellent, thanks for testing!
Committed.