mirror of
https://github.com/langgenius/dify.git
synced 2026-05-11 06:37:13 +08:00
fix: Querying document list based on hit_count caused slow SQL.
This commit is contained in:
parent
3c27a90eb9
commit
917d362a58
@ -298,6 +298,7 @@ class DatasetDocumentListApi(Resource):
|
||||
if sort == "hit_count":
|
||||
sub_query = (
|
||||
sa.select(DocumentSegment.document_id, sa.func.sum(DocumentSegment.hit_count).label("total_hit_count"))
|
||||
.where(DocumentSegment.dataset_id == str(dataset_id))
|
||||
.group_by(DocumentSegment.document_id)
|
||||
.subquery()
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user