From b8dcb31c83388970b45ae20d97b6630ab3080835 Mon Sep 17 00:00:00 2001 From: Ere Maijala <ere.maijala@helsinki.fi> Date: Mon, 30 Nov 2015 14:52:51 -0500 Subject: [PATCH] Support multiple building filter values when determining source record priority with deduplicated records - makes priority determination work with orFacets. --- .../Search/Solr/DeduplicationListener.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php b/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php index 886c04e5b3c..33bf88a354b 100644 --- a/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php +++ b/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php @@ -339,17 +339,19 @@ class DeduplicationListener { $result = []; foreach ($params->get('fq') as $fq) { - if (preg_match( - '/\bbuilding:"([^"]+)"/', //'/\bbuilding:"?\d+\/([^\/]+?)\//', + if (preg_match_all( + '/\bbuilding:"([^"]+)"/', $fq, $matches )) { - $value = $matches[1]; - if (preg_match('/^\d+\/([^\/]+?)\//', $value, $matches)) { - // Hierarchical facets; take only first level: - $result[] = $matches[1]; - } else { - $result[] = $value; + $values = $matches[1]; + foreach ($values as $value) { + if (preg_match('/^\d+\/([^\/]+?)\//', $value, $matches)) { + // Hierarchical facets; take only first level: + $result[] = $matches[1]; + } else { + $result[] = $value; + } } } } -- GitLab