protected function BackendTestBase::regressionTest1863672 in Search API 8
Regression tests for same content multiple times in the search result.
Error was caused by multiple terms for filter.
See also
https://www.drupal.org/node/1863672
1 call to BackendTestBase::regressionTest1863672()
- BackendTestBase::regressionTests in tests/
src/ Kernel/ BackendTestBase.php - Executes regression tests for issues that were already fixed.
File
- tests/
src/ Kernel/ BackendTestBase.php, line 486
Class
- BackendTestBase
- Provides a base class for backend tests.
Namespace
Drupal\Tests\search_api\KernelCode
protected function regressionTest1863672() {
$query = $this
->buildSearch();
$conditions = $query
->createConditionGroup('OR');
$conditions
->addCondition('keywords', 'orange');
$conditions
->addCondition('keywords', 'apple');
$query
->addConditionGroup($conditions);
$results = $query
->execute();
$this
->assertResults([
1,
2,
4,
5,
], $results, 'OR filter on multi-valued field');
$query = $this
->buildSearch();
$conditions = $query
->createConditionGroup('OR');
$conditions
->addCondition('keywords', 'orange');
$conditions
->addCondition('keywords', 'strawberry');
$query
->addConditionGroup($conditions);
$conditions = $query
->createConditionGroup('OR');
$conditions
->addCondition('keywords', 'apple');
$conditions
->addCondition('keywords', 'grape');
$query
->addConditionGroup($conditions);
$results = $query
->execute();
$this
->assertResults([
2,
4,
5,
], $results, 'Multiple OR filters on multi-valued field');
$query = $this
->buildSearch();
$conditions1 = $query
->createConditionGroup('OR');
$conditions = $query
->createConditionGroup('AND');
$conditions
->addCondition('keywords', 'orange');
$conditions
->addCondition('keywords', 'apple');
$conditions1
->addConditionGroup($conditions);
$conditions = $query
->createConditionGroup('AND');
$conditions
->addCondition('keywords', 'strawberry');
$conditions
->addCondition('keywords', 'grape');
$conditions1
->addConditionGroup($conditions);
$query
->addConditionGroup($conditions1);
$results = $query
->execute();
$this
->assertResults([
2,
4,
5,
], $results, 'Complex nested filters on multi-valued field');
}