mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-16 15:01:23 +01:00
d902181de9
Support a unified search query syntax which leverages more of the full-text search of each database supported by Synapse. Supports, with the same syntax across Postgresql 11+ and Sqlite: - quoted "search terms" - `AND`, `OR`, `-` (negation) operators - Matching words based on their stem, e.g. searches for "dog" matches documents containing "dogs". This is achieved by - If on postgresql 11+, pass the user input to `websearch_to_tsquery` - If on sqlite, manually parse the query and transform it into the sqlite-specific query syntax. Note that postgresql 10, which is close to end-of-life, falls back to using `phraseto_tsquery`, which only supports a subset of the features. Multiple terms separated by a space are implicitly ANDed. Note that: 1. There is no escaping of full-text syntax that might be supported by the database; e.g. `NOT`, `NEAR`, `*` in sqlite. This runs the risk that people might discover this as accidental functionality and depend on something we don't guarantee. 2. English text is assumed for stemming. To support other languages, either the target language needs to be known at the time of indexing the message (via room metadata, or otherwise), or a separate index for each language supported could be created. Sqlite docs: https://www.sqlite.org/fts3.html#full_text_index_queries Postgres docs: https://www.postgresql.org/docs/11/textsearch-controls.html |
||
---|---|---|
.. | ||
databases | ||
util | ||
__init__.py | ||
test__base.py | ||
test_account_data.py | ||
test_appservice.py | ||
test_background_update.py | ||
test_base.py | ||
test_cleanup_extrems.py | ||
test_client_ips.py | ||
test_database.py | ||
test_devices.py | ||
test_directory.py | ||
test_e2e_room_keys.py | ||
test_end_to_end_keys.py | ||
test_event_chain.py | ||
test_event_federation.py | ||
test_event_metrics.py | ||
test_event_push_actions.py | ||
test_events.py | ||
test_id_generators.py | ||
test_keys.py | ||
test_main.py | ||
test_monthly_active_users.py | ||
test_profile.py | ||
test_purge.py | ||
test_receipts.py | ||
test_redaction.py | ||
test_registration.py | ||
test_relations.py | ||
test_rollback_worker.py | ||
test_room.py | ||
test_room_search.py | ||
test_roommember.py | ||
test_state.py | ||
test_stream.py | ||
test_transactions.py | ||
test_txn_limit.py | ||
test_unsafe_locale.py | ||
test_user_directory.py |