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:
Gilles Crettenand
2015-06-03 10:02:28 +02:00
parent b81dacd194
commit da0efd72be
5 changed files with 42 additions and 20 deletions

View File

@@ -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;
}