|
|
@@ -224,9 +224,10 @@ async function syncProductsToQdrant(
|
|
|
|
|
|
console.log(`[Qdrant] Products analysis: ${productsNeedingEmbedding.length} new/changed, ${productsToReuse.length} unchanged`)
|
|
|
|
|
|
- // Collect all unique category IDs from all products
|
|
|
+ // Collect all unique category IDs from ALL products (both new/changed and reused)
|
|
|
+ // This ensures we only fetch each category once per sync run
|
|
|
const uniqueCategoryIds = new Set<string>()
|
|
|
- for (const product of productsNeedingEmbedding) {
|
|
|
+ for (const product of validProducts) {
|
|
|
const categoryRelations = product.productCategoryRelations || []
|
|
|
for (const rel of categoryRelations) {
|
|
|
const categoryId = extractCategoryId(rel.category?.href)
|