Skip to content

Commit

Permalink
SearchBox: Lower threshold for stars and correct sorting for presets (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dlurak authored Oct 16, 2024
1 parent 402a375 commit b104aab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/SearchBox/options/preset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ export const getPresetOptions = async (
const allResults = orderBy(
filtered,
[
// some bestMatches are the same for many items, then sort by name. Try out *dog*
// some bestMatches are the same for many items, then sort by name. Try out *restaurant*
({ nameSimilarity, bestMatch }) => Math.max(nameSimilarity, bestMatch),
({ nameSimilarity }) => nameSimilarity,
({ bestMatch }) => bestMatch,
],
'desc',
['desc', 'desc', 'desc'],
).map((result) => ({
type: 'preset' as const,
preset: result,
Expand Down
8 changes: 6 additions & 2 deletions src/components/SearchBox/options/stars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ export const getStarsOptions = (
if (inputValue === '') {
return stars.map((star) => ({ type: 'star', star }));
}
return diceCoefficientSort(stars, ({ label }) => label, inputValue).map(
(star) => ({ type: 'star', star }),
const sorted = diceCoefficientSort(
stars,
({ label }) => label,
inputValue,
0.25,
);
return sorted.map((star) => ({ type: 'star', star }));
};

export const renderStar = (
Expand Down

0 comments on commit b104aab

Please sign in to comment.