mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
fix: use tenant_id of kb to get index name in rm chunk func (#8760)
### What problem does this PR solve? The rm function in chunk_app.py now takes the index name differently than other functions, so there will be situations where users can create and update a chunk but not delete it. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -203,8 +203,10 @@ def rm():
|
|||||||
e, doc = DocumentService.get_by_id(req["doc_id"])
|
e, doc = DocumentService.get_by_id(req["doc_id"])
|
||||||
if not e:
|
if not e:
|
||||||
return get_data_error_result(message="Document not found!")
|
return get_data_error_result(message="Document not found!")
|
||||||
if not settings.docStoreConn.delete({"id": req["chunk_ids"]}, search.index_name(current_user.id), doc.kb_id):
|
if not settings.docStoreConn.delete({"id": req["chunk_ids"]},
|
||||||
return get_data_error_result(message="Index updating failure")
|
search.index_name(DocumentService.get_tenant_id(req["doc_id"])),
|
||||||
|
doc.kb_id):
|
||||||
|
return get_data_error_result(message="Chunk deleting failure")
|
||||||
deleted_chunk_ids = req["chunk_ids"]
|
deleted_chunk_ids = req["chunk_ids"]
|
||||||
chunk_number = len(deleted_chunk_ids)
|
chunk_number = len(deleted_chunk_ids)
|
||||||
DocumentService.decrement_chunk_num(doc.id, doc.kb_id, 1, chunk_number, 0)
|
DocumentService.decrement_chunk_num(doc.id, doc.kb_id, 1, chunk_number, 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user