fix: improve product search robustness
- search-sheets: ne bloque plus sur l'absence d'ID Shopify en col A - Shopify GraphQL: first:10 + match exact insensible à la casse au lieu de first:1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -50,9 +50,10 @@ export async function GET(req: NextRequest) {
|
||||
const refLower = ref.toLowerCase()
|
||||
const ugsLower = ugs.toLowerCase()
|
||||
const wordBoundary = new RegExp(`(^|[^a-z0-9])${ugsLower.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}([^a-z0-9]|$)`)
|
||||
const isMatch = ugs && shopifyId && wordBoundary.test(refLower)
|
||||
// Ne requiert pas shopifyId pour le match UGS — ID peut être absent si produit externe
|
||||
const isMatch = ugs && wordBoundary.test(refLower)
|
||||
|
||||
if (isMatch) {
|
||||
if (isMatch && shopifyId) {
|
||||
const title = (row[3] ?? '').trim()
|
||||
if (!bestMatch || ugs.length > bestMatch.ugsLength) {
|
||||
bestMatch = { shopifyId, title, ugsLength: ugs.length }
|
||||
|
||||
Reference in New Issue
Block a user