[Zope-CVS] CVS: Products/ZCTextIndex - ZCTextIndex.py:1.7

Jeremy Hylton jeremy@zope.com
Tue, 14 May 2002 18:13:28 -0400


Update of /cvs-repository/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv23267

Modified Files:
	ZCTextIndex.py 
Log Message:
Make OkapiIndex the default index.

ZCTextIndex has grown a new argument with a default value that can be
used to specify an Index class to use.  The default is OkapiIndex.Index.

There is a little kludge to make the test succeed.
testZCTestIndex.IndexTests uses the Index.Index tests instead of
OkapiIndex.Index.  Tim will probably fix this.


=== Products/ZCTextIndex/ZCTextIndex.py 1.6 => 1.7 ===
 from Products.PluginIndexes.common.util import parseIndexRequest
 
-from Products.ZCTextIndex.Index import Index
+from Products.ZCTextIndex.OkapiIndex import Index
 from Products.ZCTextIndex.ILexicon import ILexicon
 from Products.ZCTextIndex.Lexicon \
      import Lexicon, Splitter, CaseNormalizer, StopWordRemover
@@ -47,7 +47,7 @@
     
     query_options = ['query']
 
-    def __init__(self, id, extra, caller):
+    def __init__(self, id, extra, caller, index_factory=Index):
         self.id = id
         self._fieldname = extra.doc_attr
         lexicon = getattr(caller, extra.lexicon_id, None)
@@ -61,7 +61,7 @@
                 % lexicon.getId()
 
         self.lexicon = lexicon
-        self.index = Index(self.lexicon)
+        self.index = index_factory(self.lexicon)
         self.parser = QueryParser()
         
     ## Pluggable Index APIs ##