diff options
author | Melvyn Laïly <melvyn.laily@gmail.com> | 2024-04-26 10:43:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-26 09:43:52 +0100 |
commit | 59710437e4a885252de5e5555fbcf42d223b092c (patch) | |
tree | 4801c0791fa120c743cb8679e82f5e909464bc78 /tests/storage | |
parent | Bump serde_json from 1.0.115 to 1.0.116 (#17112) (diff) | |
download | synapse-59710437e4a885252de5e5555fbcf42d223b092c.tar.xz |
Return the search terms as search highlights for SQLite instead of nothing (#17000)
Fixes https://github.com/element-hq/synapse/issues/16999 and https://github.com/element-hq/element-android/pull/8729 by returning the search terms as search highlights.
Diffstat (limited to 'tests/storage')
-rw-r--r-- | tests/storage/test_room_search.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/storage/test_room_search.py b/tests/storage/test_room_search.py index 1eab89f140..340642b7e7 100644 --- a/tests/storage/test_room_search.py +++ b/tests/storage/test_room_search.py @@ -71,17 +71,16 @@ class EventSearchInsertionTest(HomeserverTestCase): store.search_msgs([room_id], "hi bob", ["content.body"]) ) self.assertEqual(result.get("count"), 1) - if isinstance(store.database_engine, PostgresEngine): - self.assertIn("hi", result.get("highlights")) - self.assertIn("bob", result.get("highlights")) + self.assertIn("hi", result.get("highlights")) + self.assertIn("bob", result.get("highlights")) # Check that search works for an unrelated message result = self.get_success( store.search_msgs([room_id], "another", ["content.body"]) ) self.assertEqual(result.get("count"), 1) - if isinstance(store.database_engine, PostgresEngine): - self.assertIn("another", result.get("highlights")) + + self.assertIn("another", result.get("highlights")) # Check that search works for a search term that overlaps with the message # containing a null byte and an unrelated message. @@ -90,8 +89,8 @@ class EventSearchInsertionTest(HomeserverTestCase): result = self.get_success( store.search_msgs([room_id], "hi alice", ["content.body"]) ) - if isinstance(store.database_engine, PostgresEngine): - self.assertIn("alice", result.get("highlights")) + + self.assertIn("alice", result.get("highlights")) def test_non_string(self) -> None: """Test that non-string `value`s are not inserted into `event_search`. |