From 0a23f9deee5c51334dfc45ee3eacf2f7ff42d829 Mon Sep 17 00:00:00 2001 From: Gilles Crettenand Date: Wed, 20 May 2015 16:33:29 +0200 Subject: [PATCH] books must be grouped by type --- mobile.netbiblio.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mobile.netbiblio.php b/mobile.netbiblio.php index b35d437..c0bd5de 100644 --- a/mobile.netbiblio.php +++ b/mobile.netbiblio.php @@ -395,11 +395,19 @@ class NetBiblio extends WebService } $s->addSortField('availabilityDate'); - $results = $s->getResults(0, $itemsByGroup); + try { + $results = $s->getResults(0, $itemsByGroup); + } catch(SolrClientException $e) { + throw new WebException ("SolrError", $e->getMessage(), -710); + } $ids = array_map(function($r) { return $r['id']; }, $results['response']['docs']); $books = AudioBook::findBy('NoticeID', $ids, true); - $this->data = array_map(array($this, 'AddFiles'), $books); + $books = array_map(array($this, 'AddFiles'), $books); + + foreach($books as $b) { + $this->data[$b['type']][] = $b; + } } protected function Output()