changeset 4841:3ff1a288fb9c

issue2550583, issue2550635 Do not limit results with Xapian indexer Other indexer backends do not limit the number of results. Add test with searching for 123 entries on all backends, more should not be used, because the slower backends would take too much time. enquire.get_mset was limited to 10 results and since the results can be messages instead of issues, the 10 results could even be just one issue if there were many messages matching the search term before searching the messages of other issues. Additionally the few results could be filtered by other attributes, e.g. only showing open issues, which caused even less matches.
author Thomas Arendsen Hein <thomas@intevation.de>
date Mon, 21 Oct 2013 12:56:28 +0200
parents 19f2c01d2b9d
children 1e4c45a4254b
files CHANGES.txt roundup/backends/indexer_xapian.py test/test_indexer.py
diffstat 3 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Tue Oct 08 09:46:42 2013 -0400
+++ b/CHANGES.txt	Mon Oct 21 12:56:28 2013 +0200
@@ -18,7 +18,7 @@
   traceback. (Ralf Schlatterbeck)
 - Remove Python 2.3 compatibility code for i18n (anatoly techtonik)
 - If documentation 'sphinx-build' tool is not found in system PATH,
- 'setup.py build_doc' command now tries to detect it from PYTHONPATH
+  'setup.py build_doc' command now tries to detect it from PYTHONPATH
   (anatoly techtonik)
 - Read version and release for generated documentation from
   roundup/__init__.py. (Thomas Arendsen Hein)
@@ -26,6 +26,8 @@
   (Thomas Arendsen Hein)
 - issue2550673 Make the "Make a copy" link work by fixing copy_url to properly
   handle multilink properties. (John Rouillard)
+- issue2550583, issue2550635 Do not limit results with Xapian indexer
+  (Thomas Arendsen Hein)
 
 2013-07-06: 1.5.0
 
--- a/roundup/backends/indexer_xapian.py	Tue Oct 08 09:46:42 2013 -0400
+++ b/roundup/backends/indexer_xapian.py	Mon Oct 21 12:56:28 2013 +0200
@@ -107,7 +107,7 @@
         query = xapian.Query(xapian.Query.OP_AND, terms)
 
         enquire.set_query(query)
-        matches = enquire.get_mset(0, 10)
+        matches = enquire.get_mset(0, database.get_doccount())
 
         return [tuple(m.document.get_data().split(':'))
             for m in matches]
--- a/test/test_indexer.py	Tue Oct 08 09:46:42 2013 -0400
+++ b/test/test_indexer.py	Mon Oct 21 12:56:28 2013 +0200
@@ -130,6 +130,12 @@
             self.assertSeqEqual(self.dex.find([k]),
                 [('test', '1', 'a'), ('test', '2', 'a')])
 
+    def test_manyresults(self):
+        """Test if searches find many results."""
+        for i in range(123):
+            self.dex.add_text(('test', str(i), 'many'), 'many')
+        self.assertEqual(len(self.dex.find(['many'])), 123)
+
     def tearDown(self):
         shutil.rmtree('test-index')
 

Roundup Issue Tracker: http://roundup-tracker.org/