Various fixes and cleanup :
* Always return at least success information * Fix issues with Wishes * Fix issues with Circulations * Fix typos in exceptions
This commit is contained in:
@@ -76,9 +76,12 @@ class BookSearch
|
||||
throw new WebException ("SolrError", $e->getMessage(), -700);
|
||||
}
|
||||
|
||||
$books = isset($results['response']['docs']) && $results['response']['docs'] ?
|
||||
array_map(function($o) { return (array) $o; }, $results['response']['docs']) :
|
||||
array();
|
||||
$books = array();
|
||||
if(isset($results['response']['docs']) && is_array($results['response']['docs'])) {
|
||||
foreach($results['response']['docs'] as $r) {
|
||||
$books[''.$r->id] = (array) $r;
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
'count' => $results['response']['numFound'],
|
||||
@@ -105,7 +108,8 @@ class BookSearch
|
||||
$parts = array_chunk($codes, $limit);
|
||||
$books = array();
|
||||
foreach($parts as $p) {
|
||||
$books = array_merge($books, self::GetBooks($p));
|
||||
// if we use array_merge here the numerical keys (book code) will be lost
|
||||
$books += self::GetBooks($p, $field);
|
||||
}
|
||||
return $books;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user