Skip to content

Commit

Permalink
Issue #3402831: [sorting] Always set the multivalue's first value as …
Browse files Browse the repository at this point in the history
…long as it's not NULL
  • Loading branch information
codebymikey authored Nov 20, 2023
1 parent d0e01a4 commit a8e6a1d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Plugin/search_api/backend/SearchApiSolrBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,7 @@ public function getDocuments(IndexInterface $index, array $items, UpdateQuery $u
}

// Enable sorts in some special cases.
if ($first_value && !array_key_exists($name, $special_fields)) {
if (($first_value !== NULL) && !array_key_exists($name, $special_fields)) {
if (
strpos($field_names[$name], 't') === 0 ||
strpos($field_names[$name], 's') === 0
Expand Down Expand Up @@ -2647,11 +2647,11 @@ protected function addIndexField(Document $doc, $key, array $values, $type, arra
if (empty($values)) {
if ('text' !== $type || !$this->configuration['index_empty_text_fields']) {
// Don't index empty values (i.e., when field is missing).
return '';
return NULL;
}
}

$first_value = '';
$first_value = NULL;

// All fields.
foreach ($values as $value) {
Expand Down

0 comments on commit a8e6a1d

Please sign in to comment.