Fix: order by when pick msg to rm (#12247)

### What problem does this PR solve?

Fix orde by when pick msg to remove.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

---------

Co-authored-by: Liu An <asiro@qq.com>
This commit is contained in:
Lynn
2025-12-26 19:35:21 +08:00
committed by GitHub
parent c2e9064474
commit ddcd9cf2c4

View File

@ -248,7 +248,15 @@ class ESConnection(ESConnectionBase):
# build search
s = Search()
s = s.query(bool_query)
s = s.sort(order_by)
orders = list()
for field, order in order_by.fields:
order = "asc" if order == 0 else "desc"
if field.endswith("_int") or field.endswith("_flt"):
order_info = {"order": order, "unmapped_type": "float"}
else:
order_info = {"order": order, "unmapped_type": "text"}
orders.append({field: order_info})
s = s.sort(*orders)
s = s[:limit]
q = s.to_dict()
# search