- Issue created by @3cwebdev
- Status changed to Fixed
6 months ago 8:19pm 19 May 2024 - 🇦🇹Austria drunken monkey Vienna, Austria
Sorry for taking so long to reply – it seems I overlooked this issue and was just pointed here by coincidence.
In the future, if I take longer than a month to reply, if the issue is still relevant please feel free to ping me on Slack or via my contact form. (If it stops being relevant, please do go back and close it in any case.)The answer is that the parse mode is just for the fulltext keys, not the filters/conditions, so setting conjunction
OR
on the parse mode will not influence the condition you add in any way. For combining multiple conditions withOR
, you need to add a new “condition group” with that conjunction and add conditions on that, instead of on the query directly. For instance, this code could be used to change all the existing conditions of a query to be combined withOR
, and then add one moreOR
condition:$or_conditions = $query->createConditionGroup('OR'); $old_conditions = &$query->getConditionGroup()->getConditions(); foreach ($old_conditions as $condition) { if ($condition instanceof \Drupal\search_api\Query\ConditionInterface) { $or_conditions->addCondition($condition->getField(), $condition->getValue(), $condition->getOperator()); } else { $or_conditions->addConditionGroup($condition); } } $old_conditions = []; $query->addConditionGroup($or_conditions); $or_conditions->addCondition('field_resource_location_type', 'national', 'IN');
Automatically closed - issue fixed for 2 weeks with no activity.