|
|
@@ -67,11 +67,11 @@ async function syncProductsToQdrant(
|
|
|
const startTime = new Date()
|
|
|
const collectionName = getCollectionName(storeName, 'products')
|
|
|
|
|
|
- // Filter out products without valid IDs
|
|
|
- const validProducts = products.filter(p => p && p.id)
|
|
|
+ // Filter out products without valid IDs (must have innerId)
|
|
|
+ const validProducts = products.filter(p => p && p.innerId)
|
|
|
|
|
|
if (validProducts.length === 0) {
|
|
|
- console.log('[Qdrant] No valid products to sync (all products missing IDs)')
|
|
|
+ console.log('[Qdrant] No valid products to sync (all products missing innerId)')
|
|
|
return { synced: 0, errors: 0 }
|
|
|
}
|
|
|
|
|
|
@@ -101,7 +101,7 @@ async function syncProductsToQdrant(
|
|
|
existingPoints.points.map((p: any) => p.payload?.product_id).filter(Boolean)
|
|
|
)
|
|
|
|
|
|
- const currentProductIds = new Set(validProducts.map(p => p.id.toString()))
|
|
|
+ const currentProductIds = new Set(validProducts.map(p => p.innerId.toString()))
|
|
|
|
|
|
// Find deleted products
|
|
|
const deletedProductIds = Array.from(existingProductIds).filter(
|
|
|
@@ -141,12 +141,12 @@ async function syncProductsToQdrant(
|
|
|
|
|
|
// Convert products to Qdrant points with embeddings and comprehensive details
|
|
|
const points: QdrantPoint[] = validProducts.map((product, index) => ({
|
|
|
- id: generatePointId('shoprenter', storeId, product.id),
|
|
|
+ id: generatePointId('shoprenter', storeId, product.innerId),
|
|
|
vector: embeddings[index],
|
|
|
payload: {
|
|
|
// Basic identification
|
|
|
store_id: storeId,
|
|
|
- product_id: product.id.toString(),
|
|
|
+ product_id: product.innerId.toString(),
|
|
|
platform: 'shoprenter',
|
|
|
name: product.name,
|
|
|
sku: product.sku || null,
|