fix: 修正product_documents索引创建时报错的问题

- UUID与id主键冲突,显式指定id为主键
This commit is contained in:
2025-11-05 08:05:54 +00:00
parent 28549135ab
commit 063bbda72c

View File

@ -150,7 +150,7 @@ export default defineEndpoint({
// 删除所有索引
await index.deleteAllDocuments();
try {
const enqueueRes = await index.addDocuments(docs);
const enqueueRes = await index.addDocuments(docs, { primaryKey: 'id' });
result.push({ config: cfg.collection_name, enqueued: enqueueRes });
} catch (error) {
console.error(`Error reindexing collection ${cfg.collection_name}:`, error);