diff --git a/module/VuFind/src/VuFind/Search/Solr/Results.php b/module/VuFind/src/VuFind/Search/Solr/Results.php index 232e2a9fe90d8f47b624cddd665b6531d1c111a7..cdcb1b880868c07e5c2ae554f27a57f035e3a8a4 100644 --- a/module/VuFind/src/VuFind/Search/Solr/Results.php +++ b/module/VuFind/src/VuFind/Search/Solr/Results.php @@ -411,11 +411,12 @@ class Results extends BaseResults } // Loop through every field returned by the result set - $validFields = array_keys($filter); - foreach ($this->rawResponse['facet_counts']['facet_fields'] - as $field => $data) { - // Skip filtered fields and empty arrays: - if (!in_array($field, $validFields) || count($data) < 1) { + foreach (array_keys($filter) as $field) { + $data = isset($this->rawResponse['facet_counts']['facet_fields'][$field]) + ? $this->rawResponse['facet_counts']['facet_fields'][$field] + : array(); + // Skip empty arrays: + if (count($data) < 1) { continue; } // Initialize the settings for the current field