diff roundup/indexer.py @ 1365:4884fb0860f9

fixed rdbms searching by ID [SF#666615] detect corrupted index and raise semi-useful exception [SF#666767] also some mysql support (in tests)
author Richard Jones <richard@users.sourceforge.net>
date Sun, 12 Jan 2003 23:53:20 +0000
parents 728a0809183e
children 0c736e2f1dd5
line wrap: on
line diff
--- a/roundup/indexer.py	Sun Jan 12 02:22:27 2003 +0000
+++ b/roundup/indexer.py	Sun Jan 12 23:53:20 2003 +0000
@@ -14,7 +14,7 @@
 #     that promote freedom, but obviously am giving up any rights
 #     to compel such.
 # 
-#$Id: indexer.py,v 1.14 2002-09-25 05:06:14 richard Exp $
+#$Id: indexer.py,v 1.15 2003-01-12 23:53:19 richard Exp $
 '''
 This module provides an indexer class, RoundupIndexer, that stores text
 indices in a roundup instance.  This class makes searching the content of
@@ -214,13 +214,15 @@
                 # word outside the bounds of what we index - ignore
                 continue
             word = word.upper()
-            entry = self.words.get(word)    # For each word, get index
-            entries[word] = entry           #   of matching files
-            if not entry:                   # Nothing for this one word (fail)
+            entry = self.words[word]    # For each word, get index
+            entries[word] = entry       #   of matching files
+            if not entry:               # Nothing for this one word (fail)
                 return {}
             if hits is None:
                 hits = {}
                 for k in entry.keys():
+                    if not self.fileids.has_key(k):
+                        raise ValueError, 'Index is corrupted: re-generate it'
                     hits[k] = self.fileids[k]
             else:
                 # Eliminate hits for every non-match

Roundup Issue Tracker: http://roundup-tracker.org/