diff --git a/inc/indexer.php b/inc/indexer.php
index 714feb4f76ba1fcc630f4243d9238998f7e039cd..d2a38e4a79661b46e4b5cb443feffb8092ba77cf 100644
--- a/inc/indexer.php
+++ b/inc/indexer.php
@@ -489,6 +489,9 @@ class Doku_Indexer {
         foreach ($result as $word => $res) {
             $final[$word] = array();
             foreach ($res as $wid) {
+                // handle the case when ($ixid < count($index)) has been false
+                // and thus $docs[$wid] hasn't been set.
+                if (!isset($docs[$wid])) continue;
                 $hits = &$docs[$wid];
                 foreach ($hits as $hitkey => $hitcnt) {
                     // make sure the document still exists