Discourse @{autocomplete} is Buggy

At the esteemed @codinghorror’s request I’ll try to summarize in this OP the experience we’re having with this strange, buggy, or both feature.

First … my personal expectation of proper function which seems to be commonly shared.

When entering a reference to a user into a post I expect to type an @ symbol, followed by a letter. Which will populate a pop-up dropdown with “all” (see below) users whose name starts with that letter. When I keystroke a second letter the filter will change to “all” users whose name starts with those 2 letters. etc., for 3, 4, 5, etc letters. As the filtering gets more extensive, the list should shorten towards just a few matches. So that eventually I get a short list of 1 to, say, 4 names that include my target user.

plus/minus a couple complicators.

  1. Having come from vBulletin, we know people by the Discourse “Username” field, not the “name” field. The vast majority of our users have a name field value of “”. I (/we?) understand and accept that Discourse also searches the words contained in the name field and includes them in the result set. Which results in what looks like some false positives.

  2. We would expect the returned list of matching users to be sorted into 3 groups, and alphabetic by username within each group. The groups are: a) users who have posted in this thread. b) “active users” = users who have posted to any thread “recently”, where recently might be in some fixed range such as last week, last month, or last year. c) all remaining users.

  3. The fact the dropdown is short (typically 5-6 users) is a problem since we have 300K total historical users and barely 1K active users. Useless matches to dead posters are the 99.7% likely case.


With that preliminary out of the way here's the behavior we see:

Type @N and see the popup return these users: N, Not-a-robot, Norse, Nicostorm, NormanPaperman, and NoGraceUnderPressure. Which are in no order we can determine. Oughta be alpha. All of these users haven’t been seen in decades, whereas there are many active users starting with N.

Continue typing so now we have @No` and see the popup return these users: Not-a-robot, Norse, NormanPaperman, NoGraceUnderPressure, noahjohn, and notanamesake. Again out of any logical sequence and all ancient long-dead users.

Continue typing so now we have @Nor and see the popup return these users: Norse, NormanPaperman, NoraHensl, NorseInvalidUser, NoGraceUnderPressure and FigNorton (whose name field is “Mark Norton”). Again out of any logical sequence and only FigNorton is not an ancient long-dead user.

Continue typing so now we have @Nort and see the popup return only this one user: FigNorton. But where is the equally active user “@NorthernPiper”? Why is he not there?


Trying a different case, let’s find our currently prolific user @puzzlegal.

Typing @p returns 6 different users, but at least 2 of them are currently active. @pu returns only 3 users, none of whom are our target. @puz returns nothing. Why not?

3 posts were merged into an existing topic: So, how is that @ thing supposed to work anyway?