Code

use the upload-supplied content-type if there is one
[roundup.git] / roundup / indexer.py
index 4c8b913e273eaab43a2d85bbd48a2dbbb9e3a044..9bee8bd19e19b54d5ddb4495ae522be4302a11e7 100644 (file)
@@ -14,7 +14,7 @@
 #     that promote freedom, but obviously am giving up any rights
 #     to compel such.
 # 
-#$Id: indexer.py,v 1.15 2003-01-12 23:53:19 richard Exp $
+#$Id: indexer.py,v 1.17 2004-01-20 03:58:38 richard Exp $
 '''
 This module provides an indexer class, RoundupIndexer, that stores text
 indices in a roundup instance.  This class makes searching the content of
@@ -146,7 +146,6 @@ class Indexer:
         if not hits:
             return {}
 
-        #designator_propname = {'msg': 'messages', 'file': 'files'}
         designator_propname = {}
         for nm, propclass in klass.getprops().items():
             if isinstance(propclass, Link) or isinstance(propclass, Multilink):
@@ -154,7 +153,7 @@ class Indexer:
 
         # build a dictionary of nodes and their associated messages
         # and files
-        nodeids = {}    # this is the answer
+        nodeids = {}      # this is the answer
         propspec = {}     # used to do the klass.find
         for propname in designator_propname.values():
             propspec[propname] = {}   # used as a set (value doesn't matter)
@@ -214,9 +213,9 @@ class Indexer:
                 # word outside the bounds of what we index - ignore
                 continue
             word = word.upper()
-            entry = self.words[word]    # For each word, get index
-            entries[word] = entry       #   of matching files
-            if not entry:               # Nothing for this one word (fail)
+            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)
                 return {}
             if hits is None:
                 hits = {}