|
|
@@ -641,7 +641,7 @@ def fetch_post(query_id, case_id, table="search_process"):
|
|
|
return row
|
|
|
|
|
|
|
|
|
-def fetch_all_posts(mode="process", *, query_ids=None, adopted_only=False, distinct=False,
|
|
|
+def fetch_all_posts(mode="process", *, query_ids=None, case_ids=None, adopted_only=False, distinct=False,
|
|
|
limit=None, offset=0):
|
|
|
"""某方向「全部帖子」:跨所有 query 的列表(瘦身列,口径同 fetch_posts,不拉
|
|
|
body/videos/llm_evaluation 大字段)。fetch_posts 限定单 query,本函数默认取全表。
|
|
|
@@ -661,6 +661,13 @@ def fetch_all_posts(mode="process", *, query_ids=None, adopted_only=False, disti
|
|
|
return 0, [] # 显式空列表:直接空结果,不必查库
|
|
|
where += " AND query_id IN (" + ",".join(["%s"] * len(query_ids)) + ")"
|
|
|
params = list(query_ids)
|
|
|
+ if case_ids is not None:
|
|
|
+ # case_ids:选填 case_id 列表(知识归类联动用——按「分类树节点的 knowledge_ids」
|
|
|
+ # 取被归类进该节点的帖子,而非按 query 搜索结果)。None=不过滤,[]=空结果。
|
|
|
+ if not case_ids:
|
|
|
+ return 0, []
|
|
|
+ where += " AND case_id IN (" + ",".join(["%s"] * len(case_ids)) + ")"
|
|
|
+ params += list(case_ids)
|
|
|
conn = _conn()
|
|
|
try:
|
|
|
with conn.cursor() as cur:
|