mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
fix: stricter search
This commit is contained in:
1 parent
79a01da317
commit
820c125912
4 files changed
+12
-9
No files matched your search
@@ -375,8 +375,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
return sort.direction === 'ascending' ? sorted : sorted.reverse();
|
||||
} else {
|
||||
const searchedRaw = go(filters.search, awaitedTankNames, {
|
||||
key: 'combined',
|
||||
limit: 25,
|
||||
keys: ['searchableName', 'searchableNameDeburr'],
|
||||
});
|
||||
const searchedTanks = searchedRaw.map(
|
||||
(result) => awaitedTankDefinitions[result.obj.id],
|
||||
|
||||
@@ -19,7 +19,7 @@ export default async function resolveTankId(
|
||||
`${tank}`,
|
||||
await (techTreeOnly ? tankNamesTechTreeOnly : tankNames),
|
||||
{
|
||||
keys: ['combined'],
|
||||
keys: ['searchableName', 'searchableNameDeburr'],
|
||||
limit: 1,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -187,8 +187,10 @@ export const tankNames = tanksDefinitionsArray.then((tanks) =>
|
||||
|
||||
return {
|
||||
id,
|
||||
original: tank.name,
|
||||
combined: `${tank.name}${deburr(tank.name)}${tank.nameFull ? `${tank.nameFull}${deburr(tank.nameFull)}` : ''}`,
|
||||
name: tank.name,
|
||||
nameFull: tank.nameFull,
|
||||
searchableName: tank.nameFull ?? tank.name,
|
||||
searchableNameDeburr: deburr(tank.nameFull ?? tank.name),
|
||||
treeType: tank.treeType,
|
||||
};
|
||||
}),
|
||||
|
||||
@@ -29,18 +29,20 @@ export default async function autocompleteTanks(
|
||||
focusedOption.value,
|
||||
await (techTreeOnly ? tankNamesTechTreeOnly : tankNames),
|
||||
{
|
||||
keys: ['combined'],
|
||||
keys: ['searchableName', 'searchableNameDeburr'],
|
||||
limit: 10,
|
||||
},
|
||||
).map(async (item) => {
|
||||
let name = item.obj.original;
|
||||
let name = item.obj.searchableName;
|
||||
|
||||
if (name.length > DISCORD_CHOICES_MAX_NAME_SIZE) {
|
||||
const overSize = name.length - DISCORD_CHOICES_MAX_NAME_SIZE;
|
||||
|
||||
name = `${item.obj.original.slice(
|
||||
name = `${item.obj.searchableName.slice(
|
||||
0,
|
||||
item.obj.original.length - overSize - OVERFLOW_SUFFIX.length,
|
||||
item.obj.searchableName.length -
|
||||
overSize -
|
||||
OVERFLOW_SUFFIX.length,
|
||||
)}${OVERFLOW_SUFFIX}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user