Skip to content

Commit a1a3017

Browse files
committed
Added a reserved character for Solr (v4+ supports regexes). Thanks to RealBigB for the initial patch.
1 parent cd233d6 commit a1a3017

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

haystack/backends/solr_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SolrSearchBackend(BaseSearchBackend):
2929
# The '\\' must come first, so as not to overwrite the other slash replacements.
3030
RESERVED_CHARACTERS = (
3131
'\\', '+', '-', '&&', '||', '!', '(', ')', '{', '}',
32-
'[', ']', '^', '"', '~', '*', '?', ':',
32+
'[', ']', '^', '"', '~', '*', '?', ':', '/',
3333
)
3434

3535
def __init__(self, connection_alias, **connection_options):

tests/solr_tests/tests/solr_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def test_build_query_wildcard_filter_types(self):
117117
def test_clean(self):
118118
self.assertEqual(self.sq.clean('hello world'), 'hello world')
119119
self.assertEqual(self.sq.clean('hello AND world'), 'hello and world')
120-
self.assertEqual(self.sq.clean('hello AND OR NOT TO + - && || ! ( ) { } [ ] ^ " ~ * ? : \ world'), 'hello and or not to \\+ \\- \\&& \\|| \\! \\( \\) \\{ \\} \\[ \\] \\^ \\" \\~ \\* \\? \\: \\\\ world')
120+
self.assertEqual(self.sq.clean('hello AND OR NOT TO + - && || ! ( ) { } [ ] ^ " ~ * ? : \ / world'), 'hello and or not to \\+ \\- \\&& \\|| \\! \\( \\) \\{ \\} \\[ \\] \\^ \\" \\~ \\* \\? \\: \\\\ \\/ world')
121121
self.assertEqual(self.sq.clean('so please NOTe i am in a bAND and bORed'), 'so please NOTe i am in a bAND and bORed')
122122

123123
def test_build_query_with_models(self):

0 commit comments

Comments
 (0)