Skip to content
Snippets Groups Projects
Commit 487d07bb authored by Václav Rosecký's avatar Václav Rosecký Committed by Robert Lange
Browse files

Disable deduplication listener when search parameters contains child filter (#1789)

parent 99e125e9
Branches
Tags
No related merge requests found
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
/** /**
* Solr deduplication (merged records) listener. * Solr deduplication (merged records) listener.
* *
* See https://vufind.org/wiki/indexing:deduplication for details on how this is used.
*
* PHP version 7 * PHP version 7
* *
* Copyright (C) Villanova University 2013. * Copyright (C) Villanova University 2013.
...@@ -137,7 +139,9 @@ class DeduplicationListener ...@@ -137,7 +139,9 @@ class DeduplicationListener
if ($params && in_array($context, ['search', 'similar', 'getids'])) { if ($params && in_array($context, ['search', 'similar', 'getids'])) {
// If deduplication is enabled, filter out merged child records, // If deduplication is enabled, filter out merged child records,
// otherwise filter out dedup records. // otherwise filter out dedup records.
if ($this->enabled && 'getids' !== $context) { if ($this->enabled && 'getids' !== $context
&& !$this->hasChildFilter($params)
) {
$fq = '-merged_child_boolean:true'; $fq = '-merged_child_boolean:true';
if ($context == 'similar' && $id = $event->getParam('id')) { if ($context == 'similar' && $id = $event->getParam('id')) {
$fq .= ' AND -local_ids_str_mv:"' $fq .= ' AND -local_ids_str_mv:"'
...@@ -152,6 +156,19 @@ class DeduplicationListener ...@@ -152,6 +156,19 @@ class DeduplicationListener
return $event; return $event;
} }
/**
* Check search parameters for child records filter
*
* @param array|ArrayAccess $params Search parameters
*
* @return bool
*/
public function hasChildFilter($params)
{
$filters = $params->get('fq');
return $filters != null && in_array('merged_child_boolean:true', $filters);
}
/** /**
* Fetch appropriate dedup child * Fetch appropriate dedup child
* *
......
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