public function SearchApiStandard::query in Search API 8
Set up the query for this argument.
The argument sent may be found at $this->argument.
Overrides ArgumentPluginBase::query
4 methods override SearchApiStandard::query()
- SearchApiAllTerms::query in src/
Plugin/ views/ argument/ SearchApiAllTerms.php - Set up the query for this argument.
- SearchApiDate::query in src/
Plugin/ views/ argument/ SearchApiDate.php - Set up the query for this argument.
- SearchApiFulltext::query in src/
Plugin/ views/ argument/ SearchApiFulltext.php - Set up the query for this argument.
- SearchApiMoreLikeThis::query in src/
Plugin/ views/ argument/ SearchApiMoreLikeThis.php - Set up the query for this argument.
File
- src/
Plugin/ views/ argument/ SearchApiStandard.php, line 172
Class
- SearchApiStandard
- Defines a contextual filter for applying Search API conditions.
Namespace
Drupal\search_api\Plugin\views\argumentCode
public function query($group_by = FALSE) {
$this
->fillValue();
// If there are multiple arguments, add query conditions accordingly.
// E.g 1+2+3 (for OR) or 1,2,3 (for AND).
if (count($this->value) > 1) {
if ($this->operator === 'or') {
$operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
$this->query
->addCondition($this->realField, $this->value, $operator);
}
else {
foreach ($this->value as $value) {
$operator = empty($this->options['not']) ? '=' : '<>';
$this->query
->addCondition($this->realField, $value, $operator);
}
}
}
elseif ($this->value) {
$operator = empty($this->options['not']) ? '=' : '<>';
$this->query
->addCondition($this->realField, reset($this->value), $operator);
}
}