diff --git a/module/VuFind/src/VuFind/Search/Solr/Params.php b/module/VuFind/src/VuFind/Search/Solr/Params.php index f0933dfb3902eb82c461df357bad79763f8fb3f5..e51db0cc653a78dacee78fda398d2fc6d0bf64e8 100644 --- a/module/VuFind/src/VuFind/Search/Solr/Params.php +++ b/module/VuFind/src/VuFind/Search/Solr/Params.php @@ -492,4 +492,28 @@ class Params extends \VuFind\Search\Base\Params return $backendParams; } + + /** + * Format a single filter for use in getFilterList(). + * + * @param string $field Field name + * @param string $value Field value + * @param string $operator Operator (AND/OR/NOT) + * @param bool $translate Should we translate the label? + * + * @return array + */ + protected function formatFilterListEntry($field, $value, $operator, $translate) + { + $filter = parent::formatFilterListEntry( + $field, $value, $operator, $translate + ); + + // Convert range queries to a language-non-specific format: + if (preg_match('/^\[(.*) TO (.*)\]$/', $value, $matches)) { + $filter['displayText'] = $matches[1] . '-' . $matches[2]; + } + + return $filter; + } } \ No newline at end of file diff --git a/module/VuFind/src/VuFind/Search/Summon/Params.php b/module/VuFind/src/VuFind/Search/Summon/Params.php index 6f6392c6901aca210acf37e8ae0d7b215bc51400..95cfdf41e3b90180acd02df7468e4b81e0b58425 100644 --- a/module/VuFind/src/VuFind/Search/Summon/Params.php +++ b/module/VuFind/src/VuFind/Search/Summon/Params.php @@ -260,4 +260,28 @@ class Params extends \VuFind\Search\Base\Params } } } + + /** + * Format a single filter for use in getFilterList(). + * + * @param string $field Field name + * @param string $value Field value + * @param string $operator Operator (AND/OR/NOT) + * @param bool $translate Should we translate the label? + * + * @return array + */ + protected function formatFilterListEntry($field, $value, $operator, $translate) + { + $filter = parent::formatFilterListEntry( + $field, $value, $operator, $translate + ); + + // Convert range queries to a language-non-specific format: + if (preg_match('/^\[(.*) TO (.*)\]$/', $value, $matches)) { + $filter['displayText'] = $matches[1] . '-' . $matches[2]; + } + + return $filter; + } } \ No newline at end of file