Page MenuHomePhabricator

Separate sever-side typeahead queries into "prefix" and "content" phases
ClosedPublic

Authored by epriestley on Nov 10 2016, 4:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 15, 12:22 PM
Unknown Object (File)
Mon, Dec 2, 9:52 AM
Unknown Object (File)
Thu, Nov 28, 1:43 AM
Unknown Object (File)
Tue, Nov 19, 5:06 AM
Unknown Object (File)
Nov 12 2024, 7:05 AM
Unknown Object (File)
Nov 6 2024, 12:53 AM
Unknown Object (File)
Oct 31 2024, 6:50 AM
Unknown Object (File)
Oct 29 2024, 2:05 AM
Subscribers
None

Details

Summary

Ref T8510. When users type "platypus" into a typeahead, they want "Platypus Playground" to be a higher-ranked match than "AAA Platypus", even though the latter is alphabetically first.

Specifically, the rule is: results which match the query as a prefix of the result text should rank above results which do not.

I believe we now always get this right on the client side. However, WMF has at least one case (described in T8510) where we do not get it right on the server side, and thus the user sees the wrong result.

The remaining issue is that if "platypus" matches more than 100 results, the result "Platypus Playground" may not appear in the result set at all, beacuse there are 100 copies of "AAA Platypus 1", "AAA Platypus 2", etc., first. So even though the client will apply the correct sort, it doesn't have the result the user wants and can't show it to them.

To fix this, split the server-side query into two phases:

  • In the first phase, the "prefix" phase, we find results that start with "platypus".
  • In the second phase, the "content" phase, we find results that contain "platypus" anywhere.

We skip the "prefix" phase if the user has not typed a query (for example, in the browse view).

Test Plan

This is a lot of stuff, but the new ranking here puts projects which start with "w" at the top of the list. Lower down the list, you can see some projects which contain "w" but do not appear at the top (like "Serious Work").

Screen Shot 2016-11-10 at 8.35.27 AM.png (1×2 px, 797 KB)

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable