Issue #3492: Search fails if using quotating marks
parent
b619248cfe
commit
4ea2262400
|
@ -208,10 +208,11 @@ def to_tsquery(term):
|
||||||
if not bit:
|
if not bit:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if bit.startswith('"') and bit.endswith('"'):
|
if bit.startswith('"') and bit.endswith('"') and len(bit)>2:
|
||||||
res.append(bit.replace('"', "'"))
|
res.append(bit.replace('"', "'"))
|
||||||
else:
|
else:
|
||||||
res.append("'%s':*" %(bit.replace("'", ""), ))
|
res.append("'%s':*" %(bit.replace("'", ""), ))
|
||||||
|
|
||||||
res.append("&")
|
res.append("&")
|
||||||
|
|
||||||
while res and res[-1] in magic_values:
|
while res and res[-1] in magic_values:
|
||||||
|
|
|
@ -108,6 +108,9 @@ TS_QUERY_TRANSFORMATIONS = [
|
||||||
("(1)", "( 1 )"),
|
("(1)", "( 1 )"),
|
||||||
("1((", "1"),
|
("1((", "1"),
|
||||||
("test\\", "'test':*"),
|
("test\\", "'test':*"),
|
||||||
|
('"', "'\"':*"),
|
||||||
|
('""', "'\"\"':*"),
|
||||||
|
('"""', "'\"\"':* & '\"':*"),
|
||||||
]
|
]
|
||||||
def test_to_tsquery():
|
def test_to_tsquery():
|
||||||
for (input, expected) in TS_QUERY_TRANSFORMATIONS:
|
for (input, expected) in TS_QUERY_TRANSFORMATIONS:
|
||||||
|
|
Loading…
Reference in New Issue