[Zope-CVS] CVS: Products/ZCTextIndex - ZCTextIndex.py:1.11
Tim Peters
tim.one@comcast.net
Wed, 15 May 2002 20:39:45 -0400
Update of /cvs-repository/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv29884
Modified Files:
ZCTextIndex.py
Log Message:
clear(): was ignoring the index_factory passed to the constructor,
reinitializing to the global Index even if that wasn't how the object
was constructed.
=== Products/ZCTextIndex/ZCTextIndex.py 1.10 => 1.11 ===
self.lexicon = lexicon
- self.index = index_factory(self.lexicon)
+ self._index_factory = index_factory
+ self.clear()
## Pluggable Index APIs ##
@@ -103,7 +104,7 @@
chooser = NBest(nbest)
chooser.addmany(results.items())
return chooser.getbest(), len(results)
-
+
def numObjects(self):
"""Return number of object indexed"""
return self.index.length()
@@ -119,7 +120,7 @@
def clear(self):
"""reinitialize the index"""
- self.index = Index(self.lexicon)
+ self.index = self._index_factory(self.lexicon)
def _get_object_text(self, obj):
x = getattr(obj, self._fieldname)