From fe106e6b55aa616534a4bc6030abcbde7d3ae9ee Mon Sep 17 00:00:00 2001 From: arkohut <39525455+arkohut@users.noreply.github.com> Date: Mon, 14 Oct 2024 23:28:13 +0800 Subject: [PATCH] fix: change sort by file_created_at desc --- memos/crud.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/memos/crud.py b/memos/crud.py index 6fb11fd..9ff8d56 100644 --- a/memos/crud.py +++ b/memos/crud.py @@ -457,7 +457,7 @@ def full_text_search( params["start"] = str(start) params["end"] = str(end) - sql_query += " ORDER BY bm25(entities_fts), entities.last_scan_at DESC LIMIT :limit" + sql_query += " ORDER BY bm25(entities_fts), entities.file_created_at DESC LIMIT :limit" result = db.execute(text(sql_query), params).fetchall() @@ -502,7 +502,7 @@ async def vec_search( params["start"] = str(start) params["end"] = str(end) - sql_query += " AND K = :limit ORDER BY distance, entities.last_scan_at DESC" + sql_query += " AND K = :limit ORDER BY distance, entities.file_created_at DESC" result = db.execute(text(sql_query), params).fetchall() @@ -593,6 +593,6 @@ async def list_entities( ) ) - entities = query.order_by(EntityModel.last_scan_at.desc()).limit(limit).all() + entities = query.order_by(EntityModel.file_created_at.desc()).limit(limit).all() return [Entity(**entity.__dict__) for entity in entities]