[Zope-CVS] CVS: Products/ZCTextIndex/tests - testZCTextIndex.py:1.5

Casey Duncan casey@zope.com
Wed, 15 May 2002 16:02:18 -0400


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

Modified Files:
	testZCTextIndex.py 
Log Message:
Okapi index now works w/zope.

Removed QueryParser as a persistent attribute of the ZCTextIndex so that
it doesn't need to be persistent (It stores no state).

Updated tests. Functionally tested in Zope.


=== Products/ZCTextIndex/tests/testZCTextIndex.py 1.4 => 1.5 ===
 from Products.ZCTextIndex.Lexicon import Lexicon, Splitter
 from Products.ZCTextIndex.Lexicon import CaseNormalizer, StopWordRemover
+from Products.ZCTextIndex.QueryParser import QueryParser
 
 import unittest
 
@@ -110,7 +111,7 @@
                    [(1, 0.19), (2, 0.18), (3, 0.63), (5, 0.22), (6, 0.39)]]
         for i in range(len(queries)):
             raw = queries[i]
-            q = self.zc_index.parser.parseQuery(raw)
+            q = QueryParser().parseQuery(raw)
             wq = self.index.query_weight(q.terms())
             eq(wq, scaled_int(wqs[i]))
             r = self.zc_index.query(raw)
@@ -142,7 +143,7 @@
         caller = LexiconHolder(Lexicon(Splitter(), CaseNormalizer(),
                                StopWordRemover()))
         self.zc_index = ZCTextIndex('name', extra, caller)
-        self.p = self.parser = self.zc_index.parser
+        self.p = self.parser = QueryParser()
         self.index = self.zc_index.index
         self.add_docs()