Fix: opensearch retrieval error (#10891)

### What problem does this PR solve?

Fix: opensearch retrieval error #10828

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Billy Bao
2025-10-30 17:30:54 +08:00
committed by GitHub
parent 4be3754340
commit 27f0d82102

View File

@ -400,7 +400,7 @@ class Dealer:
page_index = (page % max_pages) - 1
begin = max(page_index * page_size, 0)
sim = sim[begin : begin + page_size]
sim_np = np.array(sim)
sim_np = np.array(sim, dtype=np.float64)
idx = np.argsort(sim_np * -1)
dim = len(sres.query_vector)
vector_column = f"q_{dim}_vec"
@ -408,7 +408,7 @@ class Dealer:
filtered_count = (sim_np >= similarity_threshold).sum()
ranks["total"] = int(filtered_count) # Convert from np.int64 to Python int otherwise JSON serializable error
for i in idx:
if sim[i] < similarity_threshold:
if np.float64(sim[i]) < similarity_threshold:
break
id = sres.ids[i]