summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2022-10-27 09:58:12 -0400
committerGitHub <noreply@github.com>2022-10-27 13:58:12 +0000
commit67583281e3f8ea923eedbc56a4c85c7ba75d1582 (patch)
tree88d11b6c4b3dab2a57c804013ec64d33f6a3ae76 /synapse/storage
parentAdd workers settings to configuration manual (#14086) (diff)
downloadsynapse-67583281e3f8ea923eedbc56a4c85c7ba75d1582.tar.xz
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.
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/databases/main/search.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/synapse/storage/databases/main/search.py b/synapse/storage/databases/main/search.py
index a89fc54c2c..594b935614 100644
--- a/synapse/storage/databases/main/search.py
+++ b/synapse/storage/databases/main/search.py
@@ -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))