Commit f4e63c3e authored by Tim Peters's avatar Tim Peters

Added a number of tests to trigger search-can-return-None bugs. The three

tests that currently fail are currently commented out.

Key question:  If someone does a search on a stopword, and nothing else is
in the query, what do we want to do?  Return all docs in a random order?
Return no docs?  Raise an exception?

Second question:  What if someone does a query on

    rare_word AND NOT stop_word

?
parent 86e12d94
......@@ -95,6 +95,41 @@ class ZCIndexTestsBase:
self.assertEqual(wids, [])
self.assertEqual(len(self.index.get_words(1)), 1)
r, num = self.zc_index.query('question')
self.assertEqual(num, 1)
self.assertEqual(r[0][0], 1)
r, num = self.zc_index.query('question AND to AND be')
self.assertEqual(num, 1)
self.assertEqual(r[0][0], 1)
r, num = self.zc_index.query('to AND NOT question')
self.assertEqual(num, 0)
# 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 to be')
self.assertEqual(num, 1)
self.assertEqual(r[0][0], 1)
r, num = self.zc_index.query('to be')
self.assertEqual(num, 0)
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 AND NOT be')
self.assertEqual(num, 0)
def testDocUpdate(self):
docid = 1 # doesn't change -- we index the same doc repeatedly
N = len(text)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment