Fix relevance sorting when name/alias contains leading spaces (#4895)

This commit is contained in:
WithoutPants 2024-05-29 07:49:23 +10:00 committed by GitHub
parent 2ca53714a6
commit e4267a0d83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -89,12 +89,12 @@ export function sortByRelevance<T extends ISortable>(
} }
function getWords(o: T) { function getWords(o: T) {
return getName(o).toLowerCase().split(" "); return getName(o).trim().toLowerCase().split(" ");
} }
function getAliasWords(tag: T) { function getAliasWords(tag: T) {
const aliases = getObjectAliases(tag); const aliases = getObjectAliases(tag);
return aliases.map((a) => a.split(" ")).flat(); return aliases.map((a) => a.trim().split(" ")).flat();
} }
function getWordIndex(o: T) { function getWordIndex(o: T) {