Page MenuHomePhabricator

Repositories with hyphens sort un-usefully in global search typeahead (exact matches not necessarily first)
Closed, ResolvedPublic

Description

I'll scrub more details if needbe, but I suspect this is mostly easy to reproduce -- issue is the same as T8510 but for the global search typeahead, which has been getting closer and closer to not being a unique snowflake but still uses a chunk of special code.

Rough repro case is to create prefix, then prefix-a through prefix-f, then search for prefix and not find it as the first hit.

Event Timeline

I created these repositories:

Screen Shot 2017-07-03 at 7.11.56 AM.png (821×1 px, 138 KB)

The issue reproduces easily:

Screen Shot 2017-07-03 at 7.12.48 AM.png (821×1 px, 152 KB)

This is likely an issue with this typeahead being a bit of a special snowflake but there's some legitimate complexity here, too.

This is an issue specific to the repository names containing hyphens. The code is already calling calling the correct sort functions.

When tokenizing, we treat hyphens like space characters so that searching for zebra will find android-zebra, which is what users tend to expect.

However, this means that the internal sort strings for these repositories are:

abcdef R80
abcdef a R81

Since "R" comes after "a", it gets sorted to the bottom.

In this situation, the fix is to implode with newlines instead of spaces, as we do in Projects. This fixes the result order:

Screen Shot 2017-07-03 at 7.22.02 AM.png (696×1 px, 142 KB)

I believe this affected only repositories with hyphens (or spaces) in their names.

epriestley renamed this task from Install reporting an "exact match" issue with global search typeahead to Repositories with hyphens sort un-usefully in global search typeahead (exact matches not necessarily first).Jul 3 2017, 3:02 PM
epriestley claimed this task.