User mention search should prioritize users with access to the current category

If I’m writing a post in a category where only some users have access, the mention search (@username) should list users with access to the category first.

I would go as far that it should prioritize more active members too, when a full match happens anywhere.


Typing @arpit and none of the options contain @techAPJ, while showing users that doesn’t visit in years, have zero posts, etc.


This is a deeper problem since that list should be ordered by total post count, I would think @sam … did we regress here?

As I recall the sort order was

  • prioritize people in the current topic

and that is good and proper… but after that it should be

  • prioritize most frequent posters (globally)

I don’t think it needs to be so sophisticated as to factor in specific categories and permissions etc.


I suspect this might also be a bug based on matching on “real name” versus “username” @Falco

1 Like

Is there any time window on this? I would hate to see a prolific poster who leaves a community permanently dominate a search.

1 Like

The current priority is

  1. exact match
  2. in the topic
  3. order by last seen

Most frequent poster was never done.

I do agree with the OP though it would be nice if #3 here was “in list of groups that have access to this topic”


I don’t think this is right… so you’re saying in this list…

all those “arpits” were “last seen” before our Arpit? I don’t think so, my friend… that does not even pass the :nose: test.

I’m pretty sure it’s what I said it was

1 Like

Maybe the expectation that you can type real name and get decent results is just an unrealistic one? You have to at least match part of the username for this to work, e.g. techapj versus arpit

The scoping is done with this order if the site setting 'enable_name?` is enabled like it is here:

order(DB.sql_fragment("CASE WHEN username_lower LIKE ? THEN 0 ELSE 1 END ASC", @term_like))

So we get:

ORDER BY CASE WHEN username_lower LIKE 'arpit%' THEN 0 ELSE 1 END ASC, last_seen_at DESC LIMIT 19

This means username matches are unconditionally first.

We could change this I guess, but I worry that this will lead to a reverse problem.


I dunno @falco I have very mixed feelings about this… you’re basically saying that real name matches should have high priority. Is there any reason you couldn’t remember it was techapj and not arpit?


I don’t know about Falco and techarp but I often have to resort to real names because, well, some usernames are just not that easy to remember…

1 Like