Skip to content

Commit 9cbdb9b

Browse files
authored
fix: HybridSearch.search() crashes when OceanBase returns NULL for empty results
1 parent 76c3e4a commit 9cbdb9b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pyobvector/client/hybrid_search.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ def search(
6161
with self.engine.connect() as conn:
6262
with conn.begin():
6363
res = conn.execute(sql, {"index": index, "body_str": body_str}).fetchone()
64+
if res[0] is None:
65+
return []
6466
return json.loads(res[0])
6567

6668
def get_sql(
@@ -84,4 +86,6 @@ def get_sql(
8486
with self.engine.connect() as conn:
8587
with conn.begin():
8688
res = conn.execute(sql, {"index": index, "body_str": body_str}).fetchone()
89+
if res[0] is None:
90+
return ""
8791
return res[0]

0 commit comments

Comments
 (0)