The discussion revolves around excluding usernames from search results in Discourse. DanFFA initially raises the issue, explaining that searching for a term often yields posts from a user with a similar username, making it difficult to find relevant results. mattdm suggests that suppressing usernames unless preceded by @ could be a solution.
Stephen mentions that Discourse has a feature for reserving usernames to prevent confusion, but mattdm and DanFFA argue that this is not a practical solution, as it would require maintaining a list of problematic words and potentially removing existing usernames.
sam proposes a plugin-based approach to handle specific cases, such as stock tickers, but acknowledges that a universal solution would be complicated.
DanFFA suggests implementing a Google-like minus sign to exclude search results containing a term, which sam confirms is technically possible but would require significant work. sam agrees that supporting a - operator could be useful and will consider it in future search improvements.
Finally, Stephen proposes using tags as an alternative solution, and sam points out that excluding tags is already supported in Discourse.
Is there a way to remove a specific user’s posts from the search results? Currently, if a highly active user has a username that starts with or otherwise includes a popular term in a community such as…
Search term: ‘ABCD’
Username: ‘ABCDAndUser…’
…Searching said term often brings up a list of the username’s posts, to the point where it can be near impossible to differentiate results of that user’s random posts from ones that are actually on-topic and simply include that user in the discussion. Ideally, most members would desire a list of on-topic posts over ones that only include said user posting without the term in active use.
Edit: Currently I’m not aware of a workaround for this other than changing said username and/or users blocking said username while conducting their search. Neither of these are ideal.
It does seem like there must be some possible enhancement there — it doesn’t seem right that a name can “hijack” a search like that, and it seems likely that people might pick usernames related to any given forum’s particular topic.
I don’t know how hard this would be under the hood, but it might be good to surpress usernames unless the @ is there.
I don’t think that’s the best solution for this problem. For example, I can imagine on a car forum someone having a username proclaiming that they own or love some car model. Would you really want ban that possibility — or maintain the list?
Also, once I had to ask a support question of AT&T, and I was unable to use the name “Matthew”. Want to guess why?
Maybe I misunderstand the setting as stated. Would you have to reserve every instance of any potentially problematic word in future usernames and retroactively remove it from community members’ usernames as well?
I know for a fact we have members that use the name ‘testuser’ for instance. I.E this only would work as a solution if we used wildcards to ban usernames en masse, no? That seems like it could easily become overbearing across numerous abbreviations (this particular instance was an ETF ticker in a finance community).
Also as a practical matter, the username restriction does not work well with SSO. With that, if the SSO does not enforce the same restriction and the user unwittingly chooses a “banned” name, Discourse will assign them a random long uuid-like username.
Is there a specific reason Discourse doesn’t mimic the Google minus sign to exclude search results containing a term (or in this case a username as a term to exclude) from a search? I think that would have been the simplest workaround if it existed.
This is technically possible in our current index, but would require a bunch of work to get it going. Especially since msft_user gets tokenized down to two tokens (msft / user) so we would need to use the is followed by syntax. I can see the merit of implementing a - operator but it is not a trivial change.
Yes, apologies if this got too long in the tooth. That was certainly not my intention.
I figured I would ask after one of our members brought up this situation, since it seemed like a fitting change when your team was just recently working on improvements to the search.
No problems at all, I think it is a perfectly legitimate request, supporting -something and -"some longer phrase" could be quite useful in all sorts of cases.
It is not a trivial change, but also it is not an enormous piece of work, the main thing about this change is that it is a bit fiddly.
I am tagging this and next round of work on search we can revisit!