fix var name issue
This commit is contained in:
@@ -56,45 +56,18 @@ class NetBiblio extends WebService
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive books from Solr based on their code (NoticeNr).
|
||||
*
|
||||
* @param array $codes
|
||||
* @return array Books information
|
||||
* @throws WebException
|
||||
*/
|
||||
private function GetBooks(array $codes) {
|
||||
// it is faster to do multiple small request to Solr rather than one big so separate
|
||||
// in chunks if we are above the limit. 15 was found by testing and seems to be a sweet spot
|
||||
$limit = 15;
|
||||
$count = count($codes);
|
||||
if(count($codes) > $limit) {
|
||||
$parts = array_chunk($codes, $limit);
|
||||
$books = array();
|
||||
foreach($parts as $p) {
|
||||
$books = array_merge($books, $this->GetBooks($p));
|
||||
}
|
||||
return $books;
|
||||
}
|
||||
|
||||
$bs = new BookSearch();
|
||||
$bs->addQuery('code:('.implode(' OR ', $codes).')', null, false);
|
||||
$results = $bs->getResults(0, count($codes));
|
||||
return $results['books'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve file information (samples and zip) for a list of books based
|
||||
* on their code (NoticeNr).
|
||||
* This should be called only if those information are not already in Solr
|
||||
* for the given books.
|
||||
*
|
||||
* @param array $ids
|
||||
* @param array $codes
|
||||
* @return array File information indexed by book code
|
||||
*/
|
||||
private function GetFiles(array $codes)
|
||||
{
|
||||
$ids = array_map('intval', $codes);
|
||||
$codes = array_map('intval', $codes);
|
||||
|
||||
$uri = sprintf("%s%s",
|
||||
Configuration::get('checkfile_url'),
|
||||
|
||||
Reference in New Issue
Block a user