Commit
·
3808212
1
Parent(s):
077390b
Fix score() issue (#4194)
Browse files### What problem does this PR solve?
as title
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
Signed-off-by: jinhai <[email protected]>
rag/utils/infinity_conn.py
CHANGED
@@ -58,8 +58,11 @@ def concat_dataframes(df_list: list[pl.DataFrame], selectFields: list[str]) -> p
|
|
58 |
if df_list:
|
59 |
return pl.concat(df_list)
|
60 |
schema = dict()
|
61 |
-
for
|
62 |
-
schema
|
|
|
|
|
|
|
63 |
return pl.DataFrame(schema=schema)
|
64 |
|
65 |
@singleton
|
@@ -342,7 +345,7 @@ class InfinityConnection(DocStoreConnection):
|
|
342 |
self.connPool.release_conn(inf_conn)
|
343 |
res = concat_dataframes(df_list, selectFields)
|
344 |
if matchExprs:
|
345 |
-
res = res.sort(pl.col("
|
346 |
res = res.limit(limit)
|
347 |
logger.debug(f"INFINITY search final result: {str(res)}")
|
348 |
return res, total_hits_count
|
|
|
58 |
if df_list:
|
59 |
return pl.concat(df_list)
|
60 |
schema = dict()
|
61 |
+
for field_name in selectFields:
|
62 |
+
if field_name == 'score()': # Workaround: fix schema is changed to score()
|
63 |
+
schema['SCORE'] = str
|
64 |
+
else:
|
65 |
+
schema[field_name] = str
|
66 |
return pl.DataFrame(schema=schema)
|
67 |
|
68 |
@singleton
|
|
|
345 |
self.connPool.release_conn(inf_conn)
|
346 |
res = concat_dataframes(df_list, selectFields)
|
347 |
if matchExprs:
|
348 |
+
res = res.sort(pl.col("SCORE") + pl.col("pagerank_fea"), descending=True, maintain_order=True)
|
349 |
res = res.limit(limit)
|
350 |
logger.debug(f"INFINITY search final result: {str(res)}")
|
351 |
return res, total_hits_count
|