Skip to content
Snippets Groups Projects
Commit b6406281 authored by Dorian Merz's avatar Dorian Merz Committed by Frank Morgner
Browse files

refs #14817 [master] - fixin default filter leads to incorrect counting of hierarchy children

* changes childRecordSearch link
** adds dfApplied to URL
** avoids default filters
* adds configuration in config.ini [Hierarchy]
* decides on omission of default filters for simple container link
parent 8a4f12f7
No related merge requests found
...@@ -1344,6 +1344,16 @@ treeSearchLimit = 100 ...@@ -1344,6 +1344,16 @@ treeSearchLimit = 100
; (see the [Collections] section), so only one of them should be enabled ; (see the [Collections] section), so only one of them should be enabled
; at a time e.g. unless custom record drivers are used. ; at a time e.g. unless custom record drivers are used.
simpleContainerLinks = true simpleContainerLinks = true
; Whether the link to the search for children shall apply default filters or not. It
; dissolves unintuitive behaviour between sum of child titles at detail view and followed
; search on link of child titles displaying only titles with hidden filter. Solr search
; will be extended by additional url parameter "&dfApplied=1" if parameter is set TRUE.
; See searches.ini->[General]->default_filters
; This may also impact pre-selected facets in the search results. Please note that the
; displayed child count in the simple container link's label will always be determined
; without default filters.
; Default value is TRUE. This will not affect implementations not using default filters.
omitDefaultFiltersInChildSearch = true
; This section will be used to configure the feedback module. ; This section will be used to configure the feedback module.
; Set "tab_enabled" to true in order to enable the feedback module. ; Set "tab_enabled" to true in order to enable the feedback module.
......
...@@ -89,10 +89,12 @@ class Factory ...@@ -89,10 +89,12 @@ class Factory
*/ */
public static function getRecordLink(ServiceManager $sm) public static function getRecordLink(ServiceManager $sm)
{ {
$config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
return new RecordLink( return new RecordLink(
$sm->getServiceLocator()->get('VuFind\RecordRouter'), $sm->getServiceLocator()->get('VuFind\RecordRouter'),
$sm->getServiceLocator()->get('VuFind\RecordLoader'), $sm->getServiceLocator()->get('VuFind\RecordLoader'),
$sm->getServiceLocator()->get('VuFind\Search') $sm->getServiceLocator()->get('VuFind\Search'),
$config->Hierarchy->toArray()
); );
} }
......
...@@ -66,21 +66,30 @@ class RecordLink extends \VuFind\View\Helper\Root\RecordLink ...@@ -66,21 +66,30 @@ class RecordLink extends \VuFind\View\Helper\Root\RecordLink
*/ */
protected $searchService; protected $searchService;
/**
* Hierarchy Configuration
* @var array $hierarchyConfig
*/
protected $hierarchyConfig;
/** /**
* Constructor * Constructor
* *
* @param \VuFind\Record\Router $router Record router * @param \VuFind\Record\Router $router Record router
* @param \VuFind\Record\Loader $loader Record loader * @param \VuFind\Record\Loader $loader Record loader
* @param \VuFindSearch\Service $ss Search service * @param \VuFindSearch\Service $ss Search service
* @param array $hierarchyConfig Hierarchy configuration
*/ */
public function __construct( public function __construct(
Router $router, Router $router,
Loader $loader, Loader $loader,
SearchService $ss SearchService $ss,
$hierarchyConfig
) { ) {
$this->router = $router; $this->router = $router;
$this->recordLoader = $loader; $this->recordLoader = $loader;
$this->searchService = $ss; $this->searchService = $ss;
$this->hierarchyConfig = $hierarchyConfig;
} }
/** /**
...@@ -111,4 +120,22 @@ class RecordLink extends \VuFind\View\Helper\Root\RecordLink ...@@ -111,4 +120,22 @@ class RecordLink extends \VuFind\View\Helper\Root\RecordLink
} }
return null; return null;
} }
/**
* Get child record search url
*
* @param \VuFind\RecordDriver\AbstractBase $driver
*
* @return string
* @access public
*/
public function getChildRecordSearchUrl($driver)
{
if (isset($this->hierarchyConfig['omitDefaultFiltersInChildSearch'])
&& $this->hierarchyConfig['omitDefaultFiltersInChildSearch']) {
return (parent::getChildRecordSearchUrl($driver))
. '&dfApplied=1';
}
return parent::getChildRecordSearchUrl($driver);
}
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment