Skip to content

Commit

Permalink
Prevent error on sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
chrizzor committed Dec 3, 2024
1 parent 25ed4ae commit ddf7e74
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
12 changes: 7 additions & 5 deletions Classes/Common/Solr/SolrSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -748,11 +748,13 @@ private function getCollectionFilterQuery(string $query) : string
$collectionsQueryString = '';
$virtualCollectionsQueryString = '';
foreach ($this->collections as $collection) {
// check for virtual collections query string
if ($collection->getIndexSearch()) {
$virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collection->getIndexSearch() . ')' : ' OR (' . $collection->getIndexSearch() . ')';
} else {
$collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collection->getIndexName() . '"' : ' OR "' . $collection->getIndexName() . '"';
if ($collection !== null) {
// check for virtual collections query string
if ($collection->getIndexSearch()) {
$virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collection->getIndexSearch() . ')' : ' OR (' . $collection->getIndexSearch() . ')';
} else {
$collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collection->getIndexName() . '"' : ' OR "' . $collection->getIndexName() . '"';
}
}
}

Expand Down
10 changes: 6 additions & 4 deletions Classes/Controller/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,12 @@ private function addCollectionsQuery(string $query): string
$virtualCollectionsQueryString = '';
foreach ($collections as $collectionEntry) {
// check for virtual collections query string
if ($collectionEntry->getIndexSearch()) {
$virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collectionEntry->getIndexSearch() . ')' : ' OR (' . $collectionEntry->getIndexSearch() . ')';
} else {
$collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collectionEntry->getIndexName() . '"' : ' OR "' . $collectionEntry->getIndexName() . '"';
if ($collectionEntry !== null) {
if ($collectionEntry->getIndexSearch()) {
$virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collectionEntry->getIndexSearch() . ')' : ' OR (' . $collectionEntry->getIndexSearch() . ')';
} else {
$collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collectionEntry->getIndexName() . '"' : ' OR "' . $collectionEntry->getIndexName() . '"';
}
}
}

Expand Down

0 comments on commit ddf7e74

Please sign in to comment.