mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-10 19:18:57 +08:00
Fix: knowledge graph resolution with infinity raise error tokenizing in specific situations (#7048)
### What problem does this PR solve? When running graph resolution with infinity, if single quotation marks appeared in the entities name that to be delete, an error tokenizing of sqlglot might occur after calling infinity. For example: ``` INFINITY delete table ragflow_xxx, filter knowledge_graph_kwd IN ('entity') AND entity_kwd IN ('86 IMAGES FROM PREVIOUS CONTESTS', 'ADAM OPTIMIZATION', 'BACKGROUND'ESTIMATION') ``` may raise error ``` Error tokenizing 'TS', 'ADAM OPTIMIZATION', 'BACKGROUND'ESTIMATION'' ``` and make the document parsing failed。 Replace one single quotation mark with double single quotation marks can let sqlglot tokenize the entity name correctly. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
d9927f5185
commit
9e7d052c8d
@ -68,6 +68,7 @@ def equivalent_condition_to_str(condition: dict, table_instance=None) -> str | N
|
||||
inCond = list()
|
||||
for item in v:
|
||||
if isinstance(item, str):
|
||||
item = item.replace("'","''")
|
||||
inCond.append(f"'{item}'")
|
||||
else:
|
||||
inCond.append(str(item))
|
||||
|
Loading…
x
Reference in New Issue
Block a user