fix: recherche insensible à la casse et aux accents dans tous les filtres
- utils/search.ts : normalize() (NFD + minuscules) + matchesSearch() - ShoppingPage filteredProducts : matchesSearch sur nom ET marque - Backend searchProducts : ilike sur nom ET marque (or_) - Notes FTS : déjà insensible nativement (plainto_tsquery) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
/** Normalise une chaîne : minuscules + suppression des accents. */
|
||||
export function normalize(s: string): string {
|
||||
return s.toLowerCase().normalize('NFD').replace(/[̀-ͯ]/g, '')
|
||||
}
|
||||
|
||||
/** Vérifie si `haystack` contient `needle` (insensible casse/accents). */
|
||||
export function matchesSearch(haystack: string, needle: string): boolean {
|
||||
if (!needle) return true
|
||||
return normalize(haystack).includes(normalize(needle))
|
||||
}
|
||||
Reference in New Issue
Block a user