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