Fixed infinity exception SCORE() / SCORE_FACTORS() requires Fusion or MATCH TEXT or MATCH TENSOR (#4110)
Browse files### What problem does this PR solve?
Fixed infinity exception SCORE() / SCORE_FACTORS() requires Fusion or
MATCH TEXT or MATCH TENSOR. Close #4109
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
rag/utils/infinity_conn.py
CHANGED
@@ -247,9 +247,12 @@ class InfinityConnection(DocStoreConnection):
|
|
247 |
db_instance = inf_conn.get_database(self.dbName)
|
248 |
df_list = list()
|
249 |
table_list = list()
|
250 |
-
for essential_field in ["id"
|
251 |
if essential_field not in selectFields:
|
252 |
selectFields.append(essential_field)
|
|
|
|
|
|
|
253 |
|
254 |
# Prepare expressions common to all tables
|
255 |
filter_cond = None
|
@@ -337,7 +340,8 @@ class InfinityConnection(DocStoreConnection):
|
|
337 |
df_list.append(kb_res)
|
338 |
self.connPool.release_conn(inf_conn)
|
339 |
res = concat_dataframes(df_list, selectFields)
|
340 |
-
|
|
|
341 |
res = res.limit(limit)
|
342 |
logger.debug(f"INFINITY search final result: {str(res)}")
|
343 |
return res, total_hits_count
|
|
|
247 |
db_instance = inf_conn.get_database(self.dbName)
|
248 |
df_list = list()
|
249 |
table_list = list()
|
250 |
+
for essential_field in ["id"]:
|
251 |
if essential_field not in selectFields:
|
252 |
selectFields.append(essential_field)
|
253 |
+
if matchExprs:
|
254 |
+
for essential_field in ["score()", "pagerank_fea"]:
|
255 |
+
selectFields.append(essential_field)
|
256 |
|
257 |
# Prepare expressions common to all tables
|
258 |
filter_cond = None
|
|
|
340 |
df_list.append(kb_res)
|
341 |
self.connPool.release_conn(inf_conn)
|
342 |
res = concat_dataframes(df_list, selectFields)
|
343 |
+
if matchExprs:
|
344 |
+
res = res.sort(pl.col("SCORE") + pl.col("pagerank_fea"), descending=True, maintain_order=True)
|
345 |
res = res.limit(limit)
|
346 |
logger.debug(f"INFINITY search final result: {str(res)}")
|
347 |
return res, total_hits_count
|