/** * Figure out which bib IDs to load from the ILS. * * @param \VuFind\ILS\Connection $catalog ILS connection * @param \VuFind\Search\Solr\Params $params Solr parameters * @param string $range Range setting * @param string $dept Department setting * @param \Zend\Mvc\Controller\Plugin\FlashMessenger $flash Flash messenger * * @return array */ public function getBibIDsFromCatalog($catalog, $params, $range, $dept, $flash) { // The code always pulls in enough catalog results to get a fixed number // of pages worth of Solr results. Note that if the Solr index is out of // sync with the ILS, we may see fewer results than expected. $resultPages = $this->getResultPages(); $perPage = $params->getLimit(); $newItems = $catalog->getNewItems(1, $perPage * $resultPages, $range, $dept); // Build a list of unique IDs $bibIDs = []; for ($i = 0; $i < count($newItems['results']); $i++) { $bibIDs[] = $newItems['results'][$i]['id']; } // Truncate the list if it is too long: $limit = $params->getQueryIDLimit(); if (count($bibIDs) > $limit) { $bibIDs = array_slice($bibIDs, 0, $limit); $flash->setNamespace('info')->addMessage('too_many_new_items'); } return $bibIDs; }