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.

Comments

drunken monkey’s picture

Version: 7.x-1.0-rc1 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new1002 bytes

Thanks 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 JOIN would 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.)

francoud’s picture

Seems 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/2010084

bago’s picture

patch in #1 works for me.

drunken monkey’s picture

Status: Needs review » Fixed

Excellent, thanks for testing!
Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.