Improve relevance on command palette users search

Today, the users search in the command palette is either using a fuzzy match to match on usernames and is not being sorted by relevance, or it's using unranked text search results from Postgres, leading exact searches for usernames to fail to show results when they exist.

image.png

Proposal

Query is defined in UserClassProxy

Use Elasticsearch to search for users using:

  • a prefix search for the username field
  • a phrase match query for the username field
  • boost exact matches with username.keyword

Requirements

  • tchu@gitlab should match
  • tchu@gitlab.com should match (i.e., we don't need to partial match on the top level domain
  • Terri Chu should match
  • terri chu should match
  • tchu should match
  • tch -> brings up [ tcha, tchb, tchu, tchuser, etc.]
  • tchu@ -> brings up [tchu@gitlab, tchu@somedomain, tchu@otherdomain, etc.]
  • Ter -> brings up [Tera, Terb, Terc, ..., Terri]
  • Terri -> brings up [Terri Anderson, Terri Benson, ..., etc.]
  • Terri C -> brings up [Terri Chan, Terri Chen, ..., Terri Chu, etc.]
Edited by Madelein van Niekerk