fix(search): normalize search expansion lookup for hamza-ye variants
Deploy Canina / deploy (push) Successful in 2m42s
Deploy Canina / deploy (push) Successful in 2m42s
This commit is contained in:
1 parent
8669d183d5
commit
00ba4360cf
1 file changed
+8
-4
@@ -43,10 +43,11 @@ export const COMMON_STOP_WORDS = new Set([
|
||||
]);
|
||||
|
||||
export const SEARCH_EXPANSION_MAP: Record<string, string[]> = {
|
||||
"تایورین": ["تورین", "taurine", "taurin"],
|
||||
"تائورین": ["تورین", "taurine", "taurin"],
|
||||
"تورین": ["تائورین", "taurine", "taurin"],
|
||||
"taurine": ["تائورین", "تورین", "taurin"],
|
||||
"taurin": ["تائورین", "تورین", "taurine"],
|
||||
"تورین": ["تایورین", "تائورین", "taurine", "taurin"],
|
||||
"taurine": ["تورین", "تایورین", "تائورین", "taurin"],
|
||||
"taurin": ["تورین", "تایورین", "تائورین", "taurine"],
|
||||
"کارنیتین": ["carnitine", "l-carnitine"],
|
||||
"carnitine": ["کارنیتین", "l-carnitine"],
|
||||
"گلوکزامین": ["گلوکوزامین", "glucosamine"],
|
||||
@@ -118,7 +119,10 @@ export function extractSearchTokens(rawQuery?: string | null): string[] {
|
||||
// Expand with domain aliases (e.g. تائورین <-> تورین <-> taurine)
|
||||
const expanded = new Set<string>(baseTokens);
|
||||
for (const token of baseTokens) {
|
||||
const directAliases = SEARCH_EXPANSION_MAP[token] || SEARCH_EXPANSION_MAP[token.toLowerCase()];
|
||||
const directAliases =
|
||||
SEARCH_EXPANSION_MAP[token] ||
|
||||
SEARCH_EXPANSION_MAP[token.toLowerCase()] ||
|
||||
SEARCH_EXPANSION_MAP[normalizeSearchText(token)];
|
||||
if (directAliases) {
|
||||
for (const alias of directAliases) {
|
||||
expanded.add(normalizeSearchText(alias));
|
||||
|
||||
Reference in new issue
Block a user