Add a config option to prioritise local users in user directory search results (#9383)

This PR adds a homeserver config option, `user_directory.prefer_local_users`, that when enabled will show local users higher in user directory search results than remote users. This option is off by default.

Note that turning this on doesn't necessarily mean that remote users will always be put below local users, but they should be assuming all other ranking factors (search query match, profile information present etc) are identical.

This is useful for, say, University networks that are openly federating, but want to prioritise local students and staff in the user directory over other random users.
This commit is contained in:
Andrew Morgan 2021-02-19 11:02:03 +00:00 committed by GitHub
parent 9bc74743d5
commit 13e9029f44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 159 additions and 9 deletions

View file

@ -2554,9 +2554,14 @@ spam_checker:
# rebuild the user_directory search indexes, see
# https://github.com/matrix-org/synapse/blob/master/docs/user_directory.md
#
# 'prefer_local_users' defines whether to prioritise local users in
# search query results. If True, local users are more likely to appear above
# remote users when searching the user directory. Defaults to false.
#
#user_directory:
# enabled: true
# search_all_users: false
# prefer_local_users: false
# User Consent configuration