Homec4science

Improve tokenizer sorting rules

Authored by epriestley <git@epriestley.com> on Mar 7 2012, 22:17.

Description

Improve tokenizer sorting rules

Summary:
Currently, we sort all results alphabetically. This isn't ideal. Instead, sort them like this:

  • If the viewing user appears in the list, always sort them first. This is common in a lot of contexts and some "Ben Evans" guy is sorting first on secure.phabricator.com and causing me no end of aggravation.
  • If the tokens match a "priority" component (e.g., username), sort that before results which do not have a "priority" match.
  • Within a group (self, priority, everything else) sort tokens alphabetically.
NOTE: I need to go add setUser() to all the tokenizers to make the "self" rule work, but that's trivial so I figured I'd get this out first.

Test Plan:
https://secure.phabricator.com/file/data/4s2a72l5hhyyqqkq4bnd/PHID-FILE-x2r6ubk7s7dz54kxmtwx/Screen_Shot_2012-03-07_at_9.18.03_AM.png

Previously, "aaaaaepriestley" (first alphabetic match) would sort before "epriestley" (the viewing user). Now, "epriestley" sorts first because that is the viewer.

https://secure.phabricator.com/file/data/rmnxgnafz42f23fsjwui/PHID-FILE-yrnn55jl3ysbntldq3af/Screen_Shot_2012-03-07_at_9.18.09_AM.png

Previously, "aaaagopher" (first alphabetic match) would sort before "banana" (the "priority" match). Now, "banana" sorts first because it priority matches on username.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley

Maniphest Tasks: T946

Differential Revision: https://secure.phabricator.com/D1807

Details

Committed
epriestley <git@epriestley.com>Mar 7 2012, 22:17
Pushed
aubortJan 31 2017, 17:16
Parents
rPH76fd9a2d2832: Reduce laziness for "Mark Committed"
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH492d047a4925: Improve tokenizer sorting rules (authored by epriestley <git@epriestley.com>).Mar 7 2012, 22:17