From 28463b25ec0dcbe2fec91c9b96e204067dd2f65f Mon Sep 17 00:00:00 2001 From: Kamil Madejski Date: Thu, 14 Feb 2019 21:16:29 +0100 Subject: [PATCH] EZP-30096: Solr scoring is not taken into account in the backend search results list order (#825) * EZP-30096: Solr scoring is not taken into account in the backend search results list order * Added check if searchService supports scoring * Checked whether is not null --- src/bundle/Controller/SearchController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bundle/Controller/SearchController.php b/src/bundle/Controller/SearchController.php index 1c1535a5ff..c95329b8f8 100644 --- a/src/bundle/Controller/SearchController.php +++ b/src/bundle/Controller/SearchController.php @@ -143,7 +143,7 @@ public function searchAction(Request $request): Response $criteria = []; if (null !== $queryString) { - $criteria[] = new Criterion\FullText($queryString); + $query->query = new Criterion\FullText($queryString); } if (null !== $section) { $criteria[] = new Criterion\SectionId($section->id); @@ -176,7 +176,9 @@ public function searchAction(Request $request): Response $query->filter = new Criterion\LogicalAnd($criteria); } - $query->sortClauses[] = new SortClause\DateModified(Query::SORT_ASC); + if (!$this->searchService->supports(SearchService::CAPABILITY_SCORING)) { + $query->sortClauses[] = new SortClause\DateModified(Query::SORT_ASC); + } $pagerfanta = new Pagerfanta( new ContentSearchAdapter($query, $this->searchService)