Skip to content

Commit 9cc2ed5

Browse files
committed
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.
1 parent 784ca07 commit 9cc2ed5

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGES.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ Fixed:
1818
traceback. (Ralf Schlatterbeck)
1919
- Remove Python 2.3 compatibility code for i18n (anatoly techtonik)
2020
- If documentation 'sphinx-build' tool is not found in system PATH,
21-
'setup.py build_doc' command now tries to detect it from PYTHONPATH
21+
'setup.py build_doc' command now tries to detect it from PYTHONPATH
2222
(anatoly techtonik)
2323
- Read version and release for generated documentation from
2424
roundup/__init__.py. (Thomas Arendsen Hein)
2525
- Do not throw an internal error if a .mo file can not be read
2626
(Thomas Arendsen Hein)
2727
- issue2550673 Make the "Make a copy" link work by fixing copy_url to properly
2828
handle multilink properties. (John Rouillard)
29+
- issue2550583, issue2550635 Do not limit results with Xapian indexer
30+
(Thomas Arendsen Hein)
2931

3032
2013-07-06: 1.5.0
3133

roundup/backends/indexer_xapian.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def find(self, wordlist):
107107
query = xapian.Query(xapian.Query.OP_AND, terms)
108108

109109
enquire.set_query(query)
110-
matches = enquire.get_mset(0, 10)
110+
matches = enquire.get_mset(0, database.get_doccount())
111111

112112
return [tuple(m.document.get_data().split(':'))
113113
for m in matches]

test/test_indexer.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ def test_wordsplitting(self):
130130
self.assertSeqEqual(self.dex.find([k]),
131131
[('test', '1', 'a'), ('test', '2', 'a')])
132132

133+
def test_manyresults(self):
134+
"""Test if searches find many results."""
135+
for i in range(123):
136+
self.dex.add_text(('test', str(i), 'many'), 'many')
137+
self.assertEqual(len(self.dex.find(['many'])), 123)
138+
133139
def tearDown(self):
134140
shutil.rmtree('test-index')
135141

0 commit comments

Comments
 (0)