[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndexNG - LexiconNG.py:1.1.2.4

Andreas Jung andreas@digicool.com
Thu, 14 Feb 2002 17:57:08 -0500


Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndexNG
In directory cvs.zope.org:/tmp/cvs-serv11193

Modified Files:
      Tag: ajung-textindexng-branch
	LexiconNG.py 
Log Message:
some minor performance tweaks


=== Zope/lib/python/Products/PluginIndexes/TextIndexNG/LexiconNG.py 1.1.2.3 => 1.1.2.4 ===
         self._lexicon    = OIBTree()
         self._inverseLex = IOBTree()
+        self.num         = 0 
         
 
     def getWordIdList(self,words):
@@ -86,16 +87,14 @@
         if self._lexicon.has_key(word):
             return self._lexicon[word]
 
-
-        wid = randid()
+        wid=self.num + 1
         while not self._inverseLex.insert(wid, word):
             wid=randid()
+    
+        # we removed some optimizations here
+        self._lexicon[word] = wid
 
-        if isinstance(word,StringType):        
-            self._lexicon[intern(word)] = wid
-        else:
-            self._lexicon[word] = wid
-            
+        self.num+=1            
 
         return wid