-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
User directory search fails for certain letters #2931
Comments
This sounds eerily similar to element-hq/element-web#4950 |
@turt2live: I think you're onto something! Here are my results when I search for ...and here's what happens when I search for Seems like the database is filtering search terms for 'common' words. EDIT: I should also mention that I'm using PostgreSQL as my DB. My guess is that Postgres's full-text search feature is being 'helpful' and removing common words from the search. Is there a way to still take advantage of the weighted results of the full-text search without common words? |
The relevant portion seems to be here: synapse/synapse/storage/user_directory.py Lines 664 to 695 in 18e3a16
Indeed, if I check the English stopwords list (which lives at I did a bit of research and it's possible to do full-text search queries without using stopwords, but it involves creating a new dictionary, creating a configuration that uses that dictionary, and possibly creating an index for the new configuration. Once all of that is done, the first parameter of Given all the work that fixing this would involve, I wonder if full-text search is the right solution for user directory searches. |
I agree, the full-text search features, like derived words etc. are not really usefull when we search for user names. Should be changed to simple pattern matching in the relevant columns. |
This is pretty interesting, is this going to be fixed sometime soon? Is it a lot of work? Seems like a different method should just be used instead of to_tsquery but I'm not sure that's an easy task... |
This bug has been fixed in #8959 |
Description
I have enabled the
search_all_users
option for the user directory search (and applied the #2831 patch to fix the internal server error). I've found that the user directory search works very well except when searching for the single lettersa
,s
, andt
. Searching for other single letters of the alphabet produces the correct results.Steps to reproduce
POST to
https://matrix.floydcounty.tv/_matrix/client/r0/user_directory/search
with the proper authentication and the following JSON body:I expect to receive a list of users whose display name or username starts with the letter
t
(there would be at least 10 results on my server). Instead, I get an empty result:POSTing with some other letter, for example
j
, will return a list of users as expected.The homeserver log doesn't show anything unusual for this particular request.
Version information
The text was updated successfully, but these errors were encountered: