mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 03:39:01 +08:00
update empty document caused delete exist collection (#6392)
This commit is contained in:
parent
65bc4e0fc0
commit
443e96777b
@ -46,14 +46,15 @@ def document_indexing_update_task(dataset_id: str, document_id: str):
|
|||||||
index_processor = IndexProcessorFactory(index_type).init_index_processor()
|
index_processor = IndexProcessorFactory(index_type).init_index_processor()
|
||||||
|
|
||||||
segments = db.session.query(DocumentSegment).filter(DocumentSegment.document_id == document_id).all()
|
segments = db.session.query(DocumentSegment).filter(DocumentSegment.document_id == document_id).all()
|
||||||
index_node_ids = [segment.index_node_id for segment in segments]
|
if segments:
|
||||||
|
index_node_ids = [segment.index_node_id for segment in segments]
|
||||||
|
|
||||||
# delete from vector index
|
# delete from vector index
|
||||||
index_processor.clean(dataset, index_node_ids)
|
index_processor.clean(dataset, index_node_ids)
|
||||||
|
|
||||||
for segment in segments:
|
for segment in segments:
|
||||||
db.session.delete(segment)
|
db.session.delete(segment)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
end_at = time.perf_counter()
|
end_at = time.perf_counter()
|
||||||
logging.info(
|
logging.info(
|
||||||
click.style('Cleaned document when document update data source or process rule: {} latency: {}'.format(document_id, end_at - start_at), fg='green'))
|
click.style('Cleaned document when document update data source or process rule: {} latency: {}'.format(document_id, end_at - start_at), fg='green'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user