diff --git a/module/VuFind/src/VuFind/Controller/CollectionsController.php b/module/VuFind/src/VuFind/Controller/CollectionsController.php index 1f1b4a7d1cd8299c1974810cf4172521161efe8a..ee8ed5f8dd4c104321cc54b826fb92a9e44c7cf1 100644 --- a/module/VuFind/src/VuFind/Controller/CollectionsController.php +++ b/module/VuFind/src/VuFind/Controller/CollectionsController.php @@ -26,6 +26,7 @@ * @link http://vufind.org Main Site */ namespace VuFind\Controller; +use VuFindSearch\Query\Query; /** * Collections Controller @@ -65,13 +66,11 @@ class CollectionsController extends AbstractBase $collections = $this->getCollectionsFromTitle( $this->params()->fromQuery('title') ); - if (is_array($collections) && count($collections) != 1) { - $view = $this->createViewModel(); - $view->collections = $collections; - return $view; + if (count($collections) != 1) { + return $this->createViewModel(array('collections' => $collections)); } return $this->redirect() - ->toRoute('collection', array('id' => $collections[0]['id'])); + ->toRoute('collection', array('id' => $collections[0]->getUniqueId())); } /** @@ -331,17 +330,10 @@ class CollectionsController extends AbstractBase */ protected function getCollectionsFromTitle($title) { - $db = \VuFind\Connection\Manager::connectToIndex(); $title = addcslashes($title, '"'); - $result = $db->search( - array( - 'query' => "is_hierarchy_title:\"$title\"", - 'handler' => 'AllFields', - 'limit' => $this->getBrowseLimit() - ) - ); - - return isset($result['response']['docs']) - ? $result['response']['docs'] : array(); + $query = new Query("is_hierarchy_title:\"$title\"", 'AllFields'); + $searchService = $this->getServiceLocator()->get('VuFind\Search'); + $result = $searchService->search('Solr', $query, 0, $this->getBrowseLimit()); + return $result->getRecords(); } } diff --git a/themes/blueprint/templates/collections/bytitle.phtml b/themes/blueprint/templates/collections/bytitle.phtml index ec2c80a79b78685bce6dd9be9a9e1e62e3e89f49..b79fdba8bb8ef00e585197fae66c61c40d524b84 100644 --- a/themes/blueprint/templates/collections/bytitle.phtml +++ b/themes/blueprint/templates/collections/bytitle.phtml @@ -11,8 +11,8 @@ <div id="disambiguationItemsDiv"> <? foreach ($collections as $i => $collection): ?> <div class="disambiguationItem <?=$i % 2 ? 'alt ' : ''?>record<?=$i?>"> - <a href="<?=$this->url('collection', array('id' => $collection['id']))?>"><?=$this->escapeHtml($collection['title'])?></a> - <p><?=$this->escapeHtml($collection['description'])?></p> + <a href="<?=$this->url('collection', array('id' => $collection->getUniqueId()))?>"><?=$this->escapeHtml($collection->getTitle())?></a> + <p><?=$this->escapeHtml(implode(' ', $collection->getSummary()))?></p> </div> <? endforeach; ?> </div> diff --git a/themes/jquerymobile/templates/collections/bytitle.phtml b/themes/jquerymobile/templates/collections/bytitle.phtml index 2a008fc838ae56e0a1fc1bf8d98f72def2ae0538..36b5b62e6612765d3ef8c402093d6af67acb06f7 100644 --- a/themes/jquerymobile/templates/collections/bytitle.phtml +++ b/themes/jquerymobile/templates/collections/bytitle.phtml @@ -6,8 +6,8 @@ <ul class="results" data-role="listview" data-split-icon="plus" data-split-theme="c"> <? foreach ($collections as $i => $collection): ?> <li> - <a rel="external" href="<?=$this->url('collection', array('id' => $collection['id']))?>"><h3><?=$this->escapeHtml($collection['title'])?></h3> - <p><?=$this->escapeHtml($collection['description'])?></p> + <a rel="external" href="<?=$this->url('collection', array('id' => $collection->getUniqueId()))?>"><h3><?=$this->escapeHtml($collection->getTitle())?></h3> + <p><?=$this->escapeHtml(implode(' ', $collection->getSummary()))?></p> </a> </li> <? endforeach; ?>