Skip to content
Snippets Groups Projects
Commit 889120ee authored by Ere Maijala's avatar Ere Maijala Committed by Demian Katz
Browse files

Make empty search relevance override more robust (#1091)

- It now works when there are additional fields in the selected sort or *:* is specified as the search term. 
parent baadb799
No related merge requests found
......@@ -548,9 +548,12 @@ class Params extends \VuFind\Search\Base\Params
// Sort
$sort = $this->getSort();
if ($sort) {
// If we have an empty search with relevance sort, see if there is
// an override configured:
if ($sort == 'relevance' && $this->getQuery()->getAllTerms() == ''
// If we have an empty search with relevance sort as the primary sort
// field, see if there is an override configured:
$sortFields = explode(',', $sort);
$allTerms = trim($this->getQuery()->getAllTerms());
if ('relevance' === $sortFields[0]
&& ('' === $allTerms || '*:*' === $allTerms)
&& ($relOv = $this->getOptions()->getEmptySearchRelevanceOverride())
) {
$sort = $relOv;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment