diff --git a/module/VuFind/src/VuFind/Search/Memory.php b/module/VuFind/src/VuFind/Search/Memory.php index c2b444ff4647d588f0c02e55584a7eca963802cf..bf7d3ee3614366fb1a1c98b6d849cc6ac3973ee0 100644 --- a/module/VuFind/src/VuFind/Search/Memory.php +++ b/module/VuFind/src/VuFind/Search/Memory.php @@ -113,10 +113,16 @@ class Memory */ public function rememberParams(\VuFind\Search\Base\Params $params) { + // Since default sort may vary based on search handler, we don't want + // to force the sort value to stick unless the user chose a non-default + // option. Otherwise, if you switch between search types, unpredictable + // sort options may result. + $sort = $params->getSort(); + $defaultSort = $params->getDefaultSort(); $settings = [ 'hiddenFilters' => $params->getHiddenFilters(), 'limit' => $params->getLimit(), - 'sort' => $params->getSort(), + 'sort' => $sort === $defaultSort ? null : $sort, 'view' => $params->getView(), ]; // Special case: RSS view should not be persisted: