Skip to content

Commit 0266d1c

Browse files
committed
Fix malformed query exception on neptune edge_fulltext_search
1 parent d0a3cd9 commit 0266d1c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

graphiti_core/search/search_utils.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,17 +214,16 @@ async def edge_fulltext_search(
214214
for r in res['hits']['hits']:
215215
input_ids.append({'id': r['_source']['uuid'], 'score': r['_score']})
216216

217+
filter_query = filter_query + ' AND id(e)=id ' if filter_query else ' WHERE id(e)=id '
218+
217219
# Match the edge ids and return the values
218220
query = (
219221
"""
220-
UNWIND $ids as id
221-
MATCH (n:Entity)-[e:RELATES_TO]->(m:Entity)
222-
WHERE e.group_id IN $group_ids
223-
AND id(e)=id
224-
"""
225-
+ filter_query
226-
+ """
227-
AND id(e)=id
222+
UNWIND $ids as id
223+
MATCH (n:Entity)-[e:RELATES_TO]->(m:Entity)
224+
"""
225+
+ filter_query +
226+
"""
228227
WITH e, id.score as score, startNode(e) AS n, endNode(e) AS m
229228
RETURN
230229
e.uuid AS uuid,
@@ -240,7 +239,7 @@ async def edge_fulltext_search(
240239
e.invalid_at AS invalid_at,
241240
properties(e) AS attributes
242241
ORDER BY score DESC LIMIT $limit
243-
"""
242+
"""
244243
)
245244

246245
records, _, _ = await driver.execute_query(

0 commit comments

Comments
 (0)