diff --git a/config/vufind/Collection.ini b/config/vufind/Collection.ini index 14c41850ae2558e9854344b56253ec01ec39f246..d9657c35444f72da3bd8a196d5466b512a189221 100644 --- a/config/vufind/Collection.ini +++ b/config/vufind/Collection.ini @@ -24,6 +24,38 @@ publishDate = "adv_search_year" ; share year string w/advanced searc ; Any fields listed below will be treated as date ranges rather than plain facets: dateRange[] = publishDate +; These settings affect the way the facets are displayed +[Results_Settings] +; By default, how many values should we show for each facet? (-1 for no limit) +facet_limit = 30 +; Override facet_limit on a per-field basis using this array: +;facet_limit_by_field[format] = 50 + +; By default, the side facets will only show 6 facets and then the "show more" +; button. This can get configured with the showMore settings. +; You can use the * to set a new default setting. +showMore[*] = 6 +; Or you can set a facet specific value by using the facet name as index. +;showMore['format'] = 10 + +; Show more facets in a lightbox (paginated, no limit) +; If false, facets expand in side bar to show facets up to the above limit +; If "more", facets expand and offer an option at the bottom to open the lightbox +; If true, facets immediately open in the lightbox +showMoreInLightbox[*] = more +;lightboxLimit = 50 ; page size for the lightbox + +; Should we show "exclude" links for some or all of the facets? Set to * for +; all facets, use a comma-separated list to show for some of the facets, set +; to false or omit to disable "exclude" links +;exclude = * +; Should we OR together facets rather than ANDing them? Set to * for +; all facets, use a comma-separated list to apply to some of the facets, set +; to false or omit to disable ORed facets. +;orFacets = * +; Do we want any facets to be collapsed by default? +;collapsedFacets = * + ; These settings control which fields are available to sort on in the Collection ; module. [Sort] diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index e62fbeb614571de13332c05e6592d71fb10fd253..90bbd7bdfc90f63f658dc3e4447c55339acd3eb5 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -857,9 +857,10 @@ $staticRoutes = [ 'Primo/Advanced', 'Primo/Home', 'Primo/Search', 'QRCode/Show', 'QRCode/Unavailable', 'OAI/Server', 'Pazpar2/Home', 'Pazpar2/Search', 'Records/Home', - 'Search/Advanced', 'Search/Email', 'Search/FacetList', 'Search/History', - 'Search/Home', 'Search/NewItem', 'Search/OpenSearch', 'Search/Reserves', - 'Search/ReservesFacetList', 'Search/Results', 'Search/Suggest', + 'Search/Advanced', 'Search/CollectionFacetList', 'Search/Email', + 'Search/FacetList', 'Search/History', 'Search/Home', 'Search/NewItem', + 'Search/OpenSearch', 'Search/Reserves', 'Search/ReservesFacetList', + 'Search/Results', 'Search/Suggest', 'Summon/Advanced', 'Summon/FacetList', 'Summon/Home', 'Summon/Search', 'Tag/Home', 'Upgrade/Home', 'Upgrade/FixAnonymousTags', 'Upgrade/FixDuplicateTags', diff --git a/module/VuFind/src/VuFind/Controller/AbstractSearch.php b/module/VuFind/src/VuFind/Controller/AbstractSearch.php index 93dda1415f2e1106e45233cd30cfd91cf064d163..3d46b096ae92e0d81bca57ab220837c5f0f4bd3e 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractSearch.php +++ b/module/VuFind/src/VuFind/Controller/AbstractSearch.php @@ -729,7 +729,8 @@ class AbstractSearch extends AbstractBase 'results' => $results, 'anotherPage' => $facets[$facet]['more'], 'sort' => $sort, - 'sortOptions' => $facetSortOptions + 'sortOptions' => $facetSortOptions, + 'baseUriExtra' => $this->params()->fromQuery('baseUriExtra'), ] ); $view->setTemplate('search/facet-list'); diff --git a/module/VuFind/src/VuFind/Controller/SearchController.php b/module/VuFind/src/VuFind/Controller/SearchController.php index 61ed930c7f7a8d32c91236b4d67017ef12fca495..5b00a26d5ffef08a3e6fe011557a1434f991ff1f 100644 --- a/module/VuFind/src/VuFind/Controller/SearchController.php +++ b/module/VuFind/src/VuFind/Controller/SearchController.php @@ -72,6 +72,17 @@ class SearchController extends AbstractSearch return $view; } + /** + * Show facet list for Solr-driven collections. + * + * @return mixed + */ + public function collectionfacetlistAction() + { + $this->searchClassId = 'SolrCollection'; + return $this->facetListAction(); + } + /** * Email action - Allows the email form to appear. * diff --git a/module/VuFind/src/VuFind/Search/SolrCollection/Options.php b/module/VuFind/src/VuFind/Search/SolrCollection/Options.php index 37f671c31c2fb987fe7b8b39fa2b5782315079e8..630ae12dd7cc9596375af4bf0215eeb3f1a66fa6 100644 --- a/module/VuFind/src/VuFind/Search/SolrCollection/Options.php +++ b/module/VuFind/src/VuFind/Search/SolrCollection/Options.php @@ -45,6 +45,7 @@ class Options extends \VuFind\Search\Solr\Options */ public function __construct(\VuFind\Config\PluginManager $configLoader) { + $this->facetsIni = 'Collection'; parent::__construct($configLoader); // Load sort preferences (or defaults if none in .ini file): @@ -72,8 +73,7 @@ class Options extends \VuFind\Search\Solr\Options */ public function getFacetListAction() { - // TODO: implement support for this if needed. - return false; + return 'search-collectionfacetlist'; } /** @@ -94,4 +94,14 @@ class Options extends \VuFind\Search\Solr\Options ? $searchSettings->Recommend->toArray() : ['side' => ['CollectionSideFacets:Facets::Collection:true']]; } + + /** + * Return the route name for the search results action. + * + * @return string + */ + public function getSearchAction() + { + return 'collection'; + } } diff --git a/module/VuFind/src/VuFind/Search/SolrCollection/Params.php b/module/VuFind/src/VuFind/Search/SolrCollection/Params.php index 068ba1dc1b96a8ba196c4053de1fc538e6ff8c78..fc5a8c112b8355b805bf1ab2d9d476d3596ac5e4 100644 --- a/module/VuFind/src/VuFind/Search/SolrCollection/Params.php +++ b/module/VuFind/src/VuFind/Search/SolrCollection/Params.php @@ -101,4 +101,14 @@ class Params extends \VuFind\Search\Solr\Params { return $this->collectionField; } + + /** + * Get collection id + * + * @return string + */ + public function getCollectionId() + { + return $this->collectionID; + } } diff --git a/themes/bootstrap3/templates/Recommend/CollectionSideFacets.phtml b/themes/bootstrap3/templates/Recommend/CollectionSideFacets.phtml index f4a0e5545309e7a6b84da043b47f61c2978a7fcc..45d8d347c1a66746a8f7ffa544ed34f0016baa7f 100644 --- a/themes/bootstrap3/templates/Recommend/CollectionSideFacets.phtml +++ b/themes/bootstrap3/templates/Recommend/CollectionSideFacets.phtml @@ -39,4 +39,5 @@ <? $this->sideFacetExtraControls = ob_get_contents(); ?> <? ob_end_clean(); ?> <? endif; ?> +<? $this->baseUriExtra = $this->recommend->getResults()->getParams()->getCollectionId(); ?> <?=$this->render('Recommend/SideFacets.phtml')?> diff --git a/themes/bootstrap3/templates/Recommend/SideFacets.phtml b/themes/bootstrap3/templates/Recommend/SideFacets.phtml index 8b0eb767e3885111098047a631a31ceec34ed5c2..3c912a1144033386a05ee0207a99ab4ea14c302d 100644 --- a/themes/bootstrap3/templates/Recommend/SideFacets.phtml +++ b/themes/bootstrap3/templates/Recommend/SideFacets.phtml @@ -3,7 +3,7 @@ // Save results/options to $this so they are available to sub-templates: $this->results = $results = $this->recommend->getResults(); - $this->options = $options = $this->searchOptions($this->searchClassId); + $this->options = $options = $results->getOptions(); ?> <? if ($results->getResultTotal() > 0): ?> <h4><?=$this->transEsc(isset($this->overrideSideFacetCaption) ? $this->overrideSideFacetCaption : 'Narrow Search')?></h4> diff --git a/themes/bootstrap3/templates/Recommend/SideFacets/cluster-list.phtml b/themes/bootstrap3/templates/Recommend/SideFacets/cluster-list.phtml index e173ecfeabe164a138082f7670c0f035e4a473e3..3655c0fdcbba30df9be23e85043433bab4e90813 100644 --- a/themes/bootstrap3/templates/Recommend/SideFacets/cluster-list.phtml +++ b/themes/bootstrap3/templates/Recommend/SideFacets/cluster-list.phtml @@ -66,7 +66,12 @@ <? /* LESS and SEE MORE links */ ?> <? if (isset($i) && $i >= $this->facets_before_more): ?> <? if ($this->showMoreInLightbox === 'more' && $facetLightbox = $options->getFacetListAction()): ?> - <? $moreUrl = $this->url($facetLightbox) . $results->getUrlQuery()->getParams() . '&facet=' . $this->title . '&facetop=' . $thisFacet['operator'] . '&facetexclude=' . ($this->allowExclude ? 1 : 0); ?> + <? + $moreUrl = $this->url($facetLightbox) . $results->getUrlQuery()->getParams() . '&facet=' . $this->title . '&facetop=' . $thisFacet['operator'] . '&facetexclude=' . ($this->allowExclude ? 1 : 0); + if (!empty($this->baseUriExtra)) { + $moreUrl .= '&baseUriExtra=' . urlencode($this->baseUriExtra); + } + ?> <a class="facet narrow-toggle <?=$moreClass ?>" data-lightbox href="<?=$moreUrl ?>" rel="nofollow"><?=$this->transEsc('see all')?> ...</a> <? endif; ?> <a class="facet narrow-toggle <?=$moreClass ?>" href="#" onclick="return lessFacets('narrowGroupHidden-<?=$this->escapeHtmlAttr($this->title) ?>')"><?=$this->transEsc('less')?> ...</a> diff --git a/themes/bootstrap3/templates/search/facet-list.phtml b/themes/bootstrap3/templates/search/facet-list.phtml index 27703c6005642ecfb8a139821efb74caaeffff80..fad24c475fa008d62683dda7deeaa8a81dc1d25d 100644 --- a/themes/bootstrap3/templates/search/facet-list.phtml +++ b/themes/bootstrap3/templates/search/facet-list.phtml @@ -1,11 +1,16 @@ <? - $options = $this->searchOptions($this->searchClassId); + $options = $this->results->getParams()->getOptions(); $facetLightbox = $options->getFacetListAction(); if (empty($this->sortOptions)) { $this->sort = 'default'; $this->sortOptions = [ 'default' => 'default' ]; } $urlBase = $this->url($facetLightbox) . $results->getUrlQuery()->getParams() . '&facet=' . urlencode($this->facet) . '&facetexclude=' . $this->exclude . '&facetop=' . $this->operator; + $searchAction = $this->url($options->getSearchAction()); + if (!empty($this->baseUriExtra)) { + $searchAction .= urlencode($this->baseUriExtra); + $urlBase .= '&baseUriExtra=' . urlencode($this->baseUriExtra); + } ?> <h2><?=$this->transEsc($this->facetLabel) ?></h2> <? if (count($this->sortOptions) > 1): ?> @@ -28,8 +33,8 @@ <? endif; ?> <? foreach ($this->data as $item): ?> <? $toggleUrl = $item['isApplied'] - ? $this->url($options->getSearchAction()) . $this->results->getUrlQuery()->removeFacet($this->facet, $item['value'], $item['operator']) - : $this->url($options->getSearchAction()) . $this->results->getUrlQuery()->addFacet($this->facet, $item['value'], $item['operator']) + ? $searchAction . $this->results->getUrlQuery()->removeFacet($this->facet, $item['value'], $item['operator']) + : $searchAction . $this->results->getUrlQuery()->addFacet($this->facet, $item['value'], $item['operator']) ?> <? $subLinks = $this->exclude && !$item['isApplied']; ?> <? if ($subLinks): ?>