Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-30096: Solr scoring is not taken into account in the backend search results list order #825

Merged
merged 3 commits into from
Feb 14, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/bundle/Controller/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ public function searchAction(Request $request): Response
$created = $data->getCreated();
$creator = $data->getCreator();
$query = new Query();
$fullText = null;
$criteria = [];

if (null !== $queryString) {
$criteria[] = new Criterion\FullText($queryString);
}
$query->query = new Criterion\FullText($queryString);
kmadejski marked this conversation as resolved.
Show resolved Hide resolved

if (null !== $section) {
$criteria[] = new Criterion\SectionId($section->id);
}
Expand Down Expand Up @@ -176,7 +176,9 @@ public function searchAction(Request $request): Response
$query->filter = new Criterion\LogicalAnd($criteria);
}

$query->sortClauses[] = new SortClause\DateModified(Query::SORT_ASC);
kmadejski marked this conversation as resolved.
Show resolved Hide resolved
if (!$this->searchService->supports(SearchService::CAPABILITY_SCORING)) {
$query->sortClauses[] = new SortClause\DateModified(Query::SORT_ASC);
}

$pagerfanta = new Pagerfanta(
new ContentSearchAdapter($query, $this->searchService)
Expand Down