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

Tim Peters tim.one@comcast.net
Fri, 17 May 2002 18:18:38 -0400


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

Modified Files:
	testZCTextIndex.py 
Log Message:
Special-case None search() results in AND, AND NOT, and OR contexts, and
uncomment the test cases that were failing in these contexts.

Read it and weep <wink>:  In an AND context, None is treated like the
universal set, which jibes with the convenient fiction that stop words
appear in every doc.  However, in AND NOT and OR contexts, None is
treated like the empty set, which doesn't jibe with anything except that
we want

    real_word AND NOT stop_word

and

    real_word OR stop_word

to act like

    real_word

If we treated None as if it were the universal set, these results would
be (respectively) the empty set and the universal set instead.

At a higher level, we *are* consistent with the notion that a query with
a stop word acts the same as if the clause with the stop word weren't
present.  That's what really drives this schizophrenic (context-dependent)
treatment of None.


=== Products/ZCTextIndex/tests/testZCTextIndex.py 1.23 => 1.24 ===
         self.assertEqual(r[0][0], 1)
 
-#        r, num = self.zc_index.query('question AND NOT to AND NOT be')
-#        self.assertEqual(num, 1)
-#        self.assertEqual(r[0][0], 1)
+        r, num = self.zc_index.query('question AND NOT to AND NOT be')
+        self.assertEqual(num, 1)
+        self.assertEqual(r[0][0], 1)
 
-#        r, num = self.zc_index.query('question OR to OR be')
-#        self.assertEqual(num, 1)
-#        self.assertEqual(r[0][0], 1)
+        r, num = self.zc_index.query('question OR to OR be')
+        self.assertEqual(num, 1)
+        self.assertEqual(r[0][0], 1)
 
         r, num = self.zc_index.query('question to be')
         self.assertEqual(num, 1)
@@ -145,8 +145,8 @@
         r, num = self.zc_index.query('to AND be')
         self.assertEqual(num, 0)
 
-#        r, num = self.zc_index.query('to OR be')
-#        self.assertEqual(num, 0)
+        r, num = self.zc_index.query('to OR be')
+        self.assertEqual(num, 0)
 
         r, num = self.zc_index.query('to AND NOT be')
         self.assertEqual(num, 0)