Enhance search #215

Merged
enes merged 4 commits from issues/212-improved-search into staging 2025-02-04 09:27:09 +00:00
2 changed files with 4 additions and 2 deletions
Showing only changes of commit 688e9fcf6d - Show all commits

View File

@ -37,6 +37,7 @@ import {
extractModData,
isModDataComplete,
memoizedNormalizeSearchString,
normalizeSearchString,
scrollIntoView
} from 'utils'
import { useCuratedSet } from 'hooks/useCuratedSet'
@ -503,7 +504,7 @@ const GamesResult = ({ searchTerm }: GamesResultProps) => {
const filteredGames = useMemo(() => {
if (searchTerm === '') return []
const normalizedSearchTerm = memoizedNormalizeSearchString(searchTerm)
const normalizedSearchTerm = normalizeSearchString(searchTerm)
return games.filter((game) =>
memoizedNormalizeSearchString(game['Game Name']).includes(

View File

@ -239,9 +239,10 @@ const romanRegex = new RegExp(
export const normalizeSearchString = (str: string): string => {
str = str.toLowerCase()
str = str.replace(romanRegex, (match) => ROMAN_TO_ARABIC_MAP[match])
str = removeAccents(str)
str = removeSpecialCharacters(str)
return str.replace(romanRegex, (match) => ROMAN_TO_ARABIC_MAP[match])
return str
}
// Memoization function to cache normalized results