1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-03 20:32:07 -04:00

fix(Scorer): honour _preScored for no-query when value exceeds typeBonus (#2065)

Plugin items can set _preScored to signal a priority boost (e.g. recently
used items). Previously _preScored was only respected when a search query
was active, so no-query default lists always fell back to typeBonus+frecency
scoring, making plugin-controlled ordering impossible.

Change the condition from:
  if (query && item._preScored !== undefined)
to:
  if (item._preScored !== undefined && (query || item._preScored > 900))

This respects _preScored in no-query mode only when the value exceeds 900
(the plugin typeBonus), which avoids changing behaviour for "all" mode items
whose _preScored is set to 900-j by the controller (≤ 900). Items without
_preScored set continue to use the existing typeBonus + frecency formula.
This commit is contained in:
Jon Rogers
2026-03-23 09:25:20 -04:00
committed by GitHub
parent 4d649468d5
commit 3804d2f00b

View File

@@ -152,7 +152,7 @@ function scoreItems(items, query, getFrecencyFn) {
var item = items[i] var item = items[i]
var itemScore var itemScore
if (query && item._preScored !== undefined) { if (item._preScored !== undefined && (query || item._preScored > 900)) {
itemScore = item._preScored itemScore = item._preScored
} else { } else {
var frecencyData = getFrecencyFn ? getFrecencyFn(item) : null var frecencyData = getFrecencyFn ? getFrecencyFn(item) : null