File tree Expand file tree Collapse file tree
crates/openfang-memory/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,9 +100,14 @@ impl KnowledgeStore {
100100 let mut idx = 1 ;
101101
102102 if let Some ( ref source) = pattern. source {
103- sql. push_str ( & format ! ( " AND (s.id = ?{idx} OR s.name = ?{idx})" ) ) ;
103+ sql. push_str ( & format ! (
104+ " AND (s.id = ?{} OR s.name = ?{})" ,
105+ idx,
106+ idx + 1
107+ ) ) ;
104108 params. push ( Box :: new ( source. clone ( ) ) ) ;
105- idx += 1 ;
109+ params. push ( Box :: new ( source. clone ( ) ) ) ;
110+ idx += 2 ;
106111 }
107112 if let Some ( ref relation) = pattern. relation {
108113 let rel_str = serde_json:: to_string ( relation)
@@ -112,10 +117,16 @@ impl KnowledgeStore {
112117 idx += 1 ;
113118 }
114119 if let Some ( ref target) = pattern. target {
115- sql. push_str ( & format ! ( " AND (t.id = ?{idx} OR t.name = ?{idx})" ) ) ;
120+ sql. push_str ( & format ! (
121+ " AND (t.id = ?{} OR t.name = ?{})" ,
122+ idx,
123+ idx + 1
124+ ) ) ;
125+ params. push ( Box :: new ( target. clone ( ) ) ) ;
116126 params. push ( Box :: new ( target. clone ( ) ) ) ;
117- let _ = idx ;
127+ idx += 2 ;
118128 }
129+ let _ = idx;
119130
120131 sql. push_str ( " LIMIT 100" ) ;
121132
You can’t perform that action at this time.
0 commit comments