diff --git a/module/VuFind/src/VuFind/Controller/AuthorController.php b/module/VuFind/src/VuFind/Controller/AuthorController.php index a64233c56d0df363b3487e6efd43c4216153c4e4..ef4a66657a5fa4f8591c5ce44e6527960eb10c35 100644 --- a/module/VuFind/src/VuFind/Controller/AuthorController.php +++ b/module/VuFind/src/VuFind/Controller/AuthorController.php @@ -46,7 +46,14 @@ class AuthorController extends AbstractSearch public function resultsAction() { $this->searchClassId = 'SolrAuthor'; - $this->saveToHistory = false; + + // Save author searches if next_prev_navigation is enabled - otherwise + // there are wacky results when trying to page through results (the + // next/prev links only appear for records which were included in the + // results for the previous keyword search, and the next/prev links will + // iterate you through that search). + $this->saveToHistory = $this->resultScrollerActive(); + return parent::resultsAction(); } @@ -78,5 +85,17 @@ class AuthorController extends AbstractSearch } return $this->createViewModel(); } + + /** + * Is the result scroller active? + * + * @return bool + */ + protected function resultScrollerActive() + { + $config = $this->getServiceLocator()->get('VuFind\Config')->get('config'); + return (isset($config->Record->next_prev_navigation) + && $config->Record->next_prev_navigation); + } } diff --git a/module/VuFind/src/VuFind/Controller/Plugin/ResultScroller.php b/module/VuFind/src/VuFind/Controller/Plugin/ResultScroller.php index d9f9d23681e8ae4f70feb78fd5ba24e75dc8fc83..c0cb13990fd51fd44051fc42b07eae417f87be65 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/ResultScroller.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/ResultScroller.php @@ -98,7 +98,7 @@ class ResultScroller extends AbstractPlugin unset($this->data->prevIds); unset($this->data->nextIds); - return true; + return (bool)$this->data->currIds; } /** @@ -393,6 +393,9 @@ class ResultScroller extends AbstractPlugin $retVal = []; foreach ($searchObject->getResults() as $record) { + if (!($record instanceof \VuFind\RecordDriver\AbstractBase)) { + return false; + } $retVal[] = $record->getResourceSource() . '|' . $record->getUniqueId(); } return $retVal;