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

**URL:** <https://meta.discourse.org/t/user-mention-search-should-prioritize-users-with-access-to-the-current-category/117319>\
**Category:** UX\
**Created:** [May 10, 2019, 12:08am UTC](https://meta.discourse.org/t/user-mention-search-should-prioritize-users-with-access-to-the-current-category/117319 "2019-05-10T00:08:00Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [May 10, 2019, 4:34am UTC](https://meta.discourse.org/t/user-mention-search-should-prioritize-users-with-access-to-the-current-category/117319/8 "2019-05-10T04:34:17Z")

</div>

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.

---

_[View the full topic](https://meta.discourse.org/t/user-mention-search-should-prioritize-users-with-access-to-the-current-category/117319)._
