FEATURE: Use similarity in user search (#20112)

Currently, when doing `@mention` for users we have 0 tolerance for typos and misspellings.

With this patch, if a user search doesn't return enough results we go and use `pg_trgm` features to try and find more matches based on trigrams of usernames and names.

It also introduces GiST indexes on those fields in order to improve performance of this search, going from 130ms down to 15ms in my tests.

This is all gated in a feature flag and can be enabled by running  `SiteSetting.user_search_similar_results = true` in the rails console.
This commit is contained in:
Rafael dos Santos Silva
2023-02-02 13:35:04 -03:00
committed by GitHub
parent ca2b2d034f
commit 14cf8eacf1
5 changed files with 96 additions and 8 deletions

View File

@@ -2194,6 +2194,9 @@ backups:
client: true
search:
user_search_similar_results:
default: false
hidden: true
prioritize_exact_search_title_match:
default: false
hidden: true