minh-4T commited on
Commit
2a96248
·
1 Parent(s): eef0254

fix point empty - upset

Browse files
Files changed (1) hide show
  1. core/document_ingest_service.py +7 -2
core/document_ingest_service.py CHANGED
@@ -448,10 +448,15 @@ def process_document_ingest(
448
  effective_source_path=effective_source_path,
449
  )
450
 
451
- client.upsert(collection_name=target_collection, points=points, wait=True)
 
 
452
 
453
  db.query(DocumentChunk).filter(DocumentChunk.document_id == document.id).delete()
454
- db.bulk_save_objects(db_chunk_rows)
 
 
 
455
 
456
  if effective_source_path:
457
  document.path = effective_source_path
 
448
  effective_source_path=effective_source_path,
449
  )
450
 
451
+ # ✅ Chỉ upsert nếu có points mới (không phải cập nhật existing)
452
+ if points:
453
+ client.upsert(collection_name=target_collection, points=points, wait=True)
454
 
455
  db.query(DocumentChunk).filter(DocumentChunk.document_id == document.id).delete()
456
+
457
+ # ✅ Chỉ bulk save nếu có chunks mới
458
+ if db_chunk_rows:
459
+ db.bulk_save_objects(db_chunk_rows)
460
 
461
  if effective_source_path:
462
  document.path = effective_source_path