changeset 3551:a8acceca815a

Xapian search: fix IndexErrors happening when pages are renamed/nuked after the index was built
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 03 May 2008 19:31:44 +0200
parents 65eac5f65a11
children 7d9b8040e3be
files MoinMoin/search/builtin.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/builtin.py	Sat May 03 19:26:18 2008 +0200
+++ b/MoinMoin/search/builtin.py	Sat May 03 19:31:44 2008 +0200
@@ -649,9 +649,12 @@
 
             if wikiname in (self.request.cfg.interwikiname, 'Self'): # THIS wiki
                 page = Page(self.request, pagename, rev=revision)
-                if not self.historysearch and revision and \
-                        page.getRevList()[0] != revision:
-                    continue
+                if not self.historysearch and revision:
+                    revlist = page.getRevList()
+                    # revlist can be empty if page was nuked/renamed since it was included in xapian index
+                    if not revlist or revlist[0] != revision:
+                        # nothing there at all or not the current revision
+                        continue
                 if attachment:
                     if pagename == fs_rootpage: # not really an attachment
                         page = Page(self.request, "%s/%s" % (fs_rootpage, attachment))