mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-12 08:42:13 -04:00
@@ -713,8 +713,6 @@ Item {
|
|||||||
|
|
||||||
var apps = searchApps(searchQuery);
|
var apps = searchApps(searchQuery);
|
||||||
for (var i = 0; i < apps.length; i++) {
|
for (var i = 0; i < apps.length; i++) {
|
||||||
if (searchQuery)
|
|
||||||
apps[i]._preScored = 11000 - i;
|
|
||||||
allItems.push(apps[i]);
|
allItems.push(apps[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -722,14 +720,11 @@ Item {
|
|||||||
if (searchQuery && searchQuery.length >= 2) {
|
if (searchQuery && searchQuery.length >= 2) {
|
||||||
_pluginPhasePending = true;
|
_pluginPhasePending = true;
|
||||||
_phase1Items = allItems.slice();
|
_phase1Items = allItems.slice();
|
||||||
|
_pluginPhaseForceFirst = shouldResetSelection;
|
||||||
pluginPhaseTimer.restart();
|
pluginPhaseTimer.restart();
|
||||||
if (allItems.length === 0) {
|
isSearching = true;
|
||||||
_pluginPhaseForceFirst = shouldResetSelection;
|
searchCompleted();
|
||||||
isSearching = true;
|
return;
|
||||||
searchCompleted();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_pluginPhaseForceFirst = false;
|
|
||||||
} else if (!searchQuery) {
|
} else if (!searchQuery) {
|
||||||
var emptyTriggerOrdered = getEmptyTriggerPluginsOrdered();
|
var emptyTriggerOrdered = getEmptyTriggerPluginsOrdered();
|
||||||
for (var i = 0; i < emptyTriggerOrdered.length; i++) {
|
for (var i = 0; i < emptyTriggerOrdered.length; i++) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
const Weights = {
|
const Weights = {
|
||||||
exactMatch: 10000,
|
exactMatch: 10000,
|
||||||
prefixMatch: 5000,
|
prefixMatch: 5000,
|
||||||
wordBoundary: 1000,
|
wordBoundary: 3000,
|
||||||
substring: 500,
|
substring: 500,
|
||||||
fuzzy: 100,
|
fuzzy: 100,
|
||||||
frecency: 2000,
|
frecency: 2000,
|
||||||
@@ -99,8 +99,8 @@ function getTimeBucketWeight(daysSinceUsed) {
|
|||||||
function calculateTextScore(name, query) {
|
function calculateTextScore(name, query) {
|
||||||
if (name === query) return Weights.exactMatch
|
if (name === query) return Weights.exactMatch
|
||||||
if (name.startsWith(query)) return Weights.prefixMatch
|
if (name.startsWith(query)) return Weights.prefixMatch
|
||||||
if (name.includes(query)) return Weights.substring
|
|
||||||
if (hasWordBoundaryMatch(name, query)) return Weights.wordBoundary
|
if (hasWordBoundaryMatch(name, query)) return Weights.wordBoundary
|
||||||
|
if (name.includes(query)) return Weights.substring
|
||||||
|
|
||||||
if (query.length >= 3) {
|
if (query.length >= 3) {
|
||||||
var fs = fuzzyScore(name, query)
|
var fs = fuzzyScore(name, query)
|
||||||
@@ -140,7 +140,7 @@ function score(item, query, frecencyData) {
|
|||||||
|
|
||||||
if (textScore === 0) return 0
|
if (textScore === 0) return 0
|
||||||
|
|
||||||
var usageBonus = frecencyData ? Math.min(frecencyData.usageCount * 10, Weights.frecency) : 0
|
var usageBonus = frecencyData ? Math.min(frecencyData.usageCount * 50, Weights.frecency) : 0
|
||||||
|
|
||||||
return textScore + usageBonus + typeBonus
|
return textScore + usageBonus + typeBonus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -494,7 +494,7 @@ Singleton {
|
|||||||
textScore = 5000;
|
textScore = 5000;
|
||||||
matchType = "prefix";
|
matchType = "prefix";
|
||||||
} else if (wordBoundaryMatch(name, queryLower)) {
|
} else if (wordBoundaryMatch(name, queryLower)) {
|
||||||
textScore = 1000;
|
textScore = 3000;
|
||||||
matchType = "word_boundary";
|
matchType = "word_boundary";
|
||||||
} else if (name.includes(queryLower)) {
|
} else if (name.includes(queryLower)) {
|
||||||
textScore = 500;
|
textScore = 500;
|
||||||
@@ -551,7 +551,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const result of results) {
|
for (const result of results) {
|
||||||
const frecencyBonus = result.frecency > 0 ? Math.min(result.frecency / 10, 2000) : 0;
|
const frecencyBonus = result.frecency > 0 ? Math.min(result.frecency, 2000) : 0;
|
||||||
const recencyBonus = result.daysSinceUsed < 1 ? 1500 : result.daysSinceUsed < 7 ? 1000 : result.daysSinceUsed < 30 ? 500 : 0;
|
const recencyBonus = result.daysSinceUsed < 1 ? 1500 : result.daysSinceUsed < 7 ? 1000 : result.daysSinceUsed < 30 ? 500 : 0;
|
||||||
|
|
||||||
const finalScore = result.textScore + frecencyBonus + recencyBonus;
|
const finalScore = result.textScore + frecencyBonus + recencyBonus;
|
||||||
|
|||||||
Reference in New Issue
Block a user