From 757d8d42dd985db985c9c8aa2320f846b98f6b0e Mon Sep 17 00:00:00 2001 From: yH <129517178+yuehong136@users.noreply.github.com> Date: Thu, 19 Mar 2026 17:55:40 +0800 Subject: [PATCH] Fix: use configured OrderByExpr in _community_retrieval_ (#13683) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `odr` variable was configured with `desc("weight_flt")` but a new empty `OrderByExpr()` was passed to `dataStore.search()` instead, causing the descending sort to have no effect. ### What problem does this PR solve? In `_community_retrieval_`, the configured `OrderByExpr` with `desc("weight_flt")` was discarded — a new empty `OrderByExpr()` was passed to `dataStore.search()` instead, so community reports were never sorted by weight. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/graphrag/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rag/graphrag/search.py b/rag/graphrag/search.py index 552b64ec99..ba57783be8 100644 --- a/rag/graphrag/search.py +++ b/rag/graphrag/search.py @@ -299,7 +299,7 @@ class KGSearch(Dealer): fltr["knowledge_graph_kwd"] = "community_report" fltr["entities_kwd"] = entities comm_res = self.dataStore.search(fields, [], fltr, [], - OrderByExpr(), 0, topn, idxnms, kb_ids) + odr, 0, topn, idxnms, kb_ids) comm_res_fields = self.dataStore.get_fields(comm_res, fields) txts = [] for ii, (_, row) in enumerate(comm_res_fields.items()):