Skip to content

Commit 51700fd

Browse files
committed
Fix xapian indexer for unicode
Make regular expression pattern match words as unicode.
1 parent 2f2b83e commit 51700fd

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

roundup/backends/indexer_xapian.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def add_text(self, identifier, text, mime_type='text/plain'):
9595

9696
for match in re.finditer(r'\b\w{%d,%d}\b'
9797
% (self.minlength, self.maxlength),
98-
text.upper()):
98+
text.upper(), re.UNICODE):
9999
word = match.group(0)
100100
if self.is_stopword(word):
101101
continue

test/test_indexer.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,6 @@
5050
skip_whoosh = mark_class(pytest.mark.skip(
5151
"Skipping Whoosh indexer tests: 'whoosh' not installed"))
5252

53-
54-
import sys
55-
if sys.version_info[0] > 2:
56-
unicode_fails_py2 = lambda func, *args, **kwargs: func
57-
else:
58-
unicode_fails_py2 = pytest.mark.xfail(
59-
reason="Unicode indexing expected to fail under python 2")
60-
6153
class db:
6254
class config(dict):
6355
DATABASE = 'test-index'
@@ -165,7 +157,6 @@ def test_manyresults(self):
165157
self.dex.add_text(('test', str(i), 'many'), 'many')
166158
self.assertEqual(len(self.dex.find(['many'])), 123)
167159

168-
@unicode_fails_py2
169160
def test_unicode(self):
170161
"""Test with unicode words. see:
171162
https://issues.roundup-tracker.org/issue1344046"""

0 commit comments

Comments
 (0)