mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-27 14:55:16 -04:00
Fix tests for change in PostgreSQL 14 behavior change. (#14310)
PostgreSQL 14 changed the behavior of `websearch_to_tsquery` to improve some behaviour. The tests were hitting those edge-cases about handling of hanging double quotes. This fixes the tests to take into account the PostgreSQL version.
This commit is contained in:
parent
1357ae869f
commit
67583281e3
3 changed files with 15 additions and 7 deletions
|
@ -824,9 +824,8 @@ def _tokenize_query(query: str) -> TokenList:
|
|||
in_phrase = False
|
||||
parts = deque(query.split('"'))
|
||||
for i, part in enumerate(parts):
|
||||
# The contents inside double quotes is treated as a phrase, a trailing
|
||||
# double quote is not implied.
|
||||
in_phrase = bool(i % 2) and i != (len(parts) - 1)
|
||||
# The contents inside double quotes is treated as a phrase.
|
||||
in_phrase = bool(i % 2)
|
||||
|
||||
# Pull out the individual words, discarding any non-word characters.
|
||||
words = deque(re.findall(r"([\w\-]+)", part, re.UNICODE))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue