diff --git a/module/VuFind/src/VuFind/Sitemap/Generator.php b/module/VuFind/src/VuFind/Sitemap/Generator.php
index 5949133cb7c7f1326704f391ba3fac3aef388c13..fdddcf0294c7a8d2a4970a9b34019e7a93efaa1e 100644
--- a/module/VuFind/src/VuFind/Sitemap/Generator.php
+++ b/module/VuFind/src/VuFind/Sitemap/Generator.php
@@ -459,6 +459,7 @@ class Generator
             $this->countPerPage,
             $params
         );
+        $ids = [];
         foreach ($results->getRecords() as $doc) {
             $ids[] = $doc->get($key);
         }