From 44cfdc2f345a4fcb8ea7c407b4e943fbc1971e6a Mon Sep 17 00:00:00 2001 From: Adrien Dupuis Date: Fri, 17 Nov 2023 14:13:51 +0100 Subject: [PATCH] SearchQueryType.php: Do not add SortClause\ContentId if there is already sort clauses. --- src/lib/QueryType/SearchQueryType.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/QueryType/SearchQueryType.php b/src/lib/QueryType/SearchQueryType.php index 7bca8cc..522f040 100644 --- a/src/lib/QueryType/SearchQueryType.php +++ b/src/lib/QueryType/SearchQueryType.php @@ -54,8 +54,10 @@ protected function doGetQuery(array $parameters): Query $query->sortClauses = $sortingDefinition->getSortClauses(); } - // Search results order MUST BE deterministic - $query->sortClauses[] = new ContentId(Query::SORT_ASC); + if (empty($query->sortClauses)) { + // Search results order MUST BE deterministic + $query->sortClauses[] = new ContentId(Query::SORT_ASC); + } if ($this->searchService->supports(SearchService::CAPABILITY_AGGREGATIONS)) { $query->aggregations[] = $this->buildContentTypeTermAggregation($parameters);