mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
fix(search.py):remove hard page_size (#8242)
### What problem does this PR solve? Fix the restriction of forcing similarity_threshold=0 and page_size=30 when doc_ids is not empty #8228 --------- Co-authored-by: shiqing.wusq <shiqing.wusq@dtzhejiang.com> Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
@ -380,15 +380,12 @@ class Dealer:
|
|||||||
rank_feature=rank_feature)
|
rank_feature=rank_feature)
|
||||||
# Already paginated in search function
|
# Already paginated in search function
|
||||||
idx = np.argsort(sim * -1)[(page - 1) * page_size:page * page_size]
|
idx = np.argsort(sim * -1)[(page - 1) * page_size:page * page_size]
|
||||||
|
|
||||||
|
|
||||||
dim = len(sres.query_vector)
|
dim = len(sres.query_vector)
|
||||||
vector_column = f"q_{dim}_vec"
|
vector_column = f"q_{dim}_vec"
|
||||||
zero_vector = [0.0] * dim
|
zero_vector = [0.0] * dim
|
||||||
if doc_ids:
|
|
||||||
similarity_threshold = 0
|
|
||||||
page_size = 30
|
|
||||||
sim_np = np.array(sim)
|
sim_np = np.array(sim)
|
||||||
|
if doc_ids:
|
||||||
|
similarity_threshold = 0
|
||||||
filtered_count = (sim_np >= similarity_threshold).sum()
|
filtered_count = (sim_np >= similarity_threshold).sum()
|
||||||
ranks["total"] = int(filtered_count) # Convert from np.int64 to Python int otherwise JSON serializable error
|
ranks["total"] = int(filtered_count) # Convert from np.int64 to Python int otherwise JSON serializable error
|
||||||
for i in idx:
|
for i in idx:
|
||||||
|
|||||||
Reference in New Issue
Block a user