diff --git a/module/VuFind/src/VuFind/Search/Solr/Params.php b/module/VuFind/src/VuFind/Search/Solr/Params.php
index b65d6a9d6629ca34077fb15d6a40439ce808dc4a..fea7aaac953e6ef5845d95f1139c230f03e5a1c3 100644
--- a/module/VuFind/src/VuFind/Search/Solr/Params.php
+++ b/module/VuFind/src/VuFind/Search/Solr/Params.php
@@ -385,9 +385,8 @@ class Params extends BaseParams
     {
         // No need for spell checking on an ID query!
         $this->options->spellcheckEnabled(false);
-        for ($i = 0; $i < count($ids); $i++) {
-            $ids[$i] = '"' . addcslashes($ids[$i], '"') . '"';
-        }
+        $callback = function($i) { return '"' . addcslashes($i, '"') . '"'; };
+        $ids = array_map($callback, $ids);
         $this->setOverrideQuery('id:(' . implode(' OR ', $ids) . ')');
     }