Rank installed apps above equally matching menu entries
Searching the menu for an installed app buried it: "brave" listed Setup > Defaults > Browser, Install > Browser and Remove > Browser ahead of the Brave app itself. All four are exact label matches scoring 0, so the tiebreak falls to declaration order, and mergeAppRows appends app rows after every static item. Bias app rows ahead of menu entries that match equally well. The bias is smaller than the gap between match tiers, so a menu entry that matches the query better still sorts first. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
a8977c4433
commit
ab798d80b2
@@ -309,6 +309,12 @@ function searchScore(items, entry, query) {
|
||||
else if (descriptionTextMatches(needle, descriptionText)) score = 60
|
||||
|
||||
if (entry.kind === "menu" || entry.kind === "link") score -= 2
|
||||
// mergeAppRows appends app rows after every menu item, so an app always
|
||||
// loses the order tiebreak below to a menu entry that matches just as well.
|
||||
// Searching an installed app's name should launch it, not offer to install
|
||||
// or remove it. The bias stays under the 10-point gap between match tiers,
|
||||
// so a menu entry that matches better still sorts first.
|
||||
if (entry.kind === "app") score -= 5
|
||||
|
||||
return score * 1000 + depthFor(items, entry.id) * 25 + entry.order
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user