This commit is contained in:
dontang97 2025-12-14 10:58:56 +07:00 committed by GitHub
commit ec78dc4ded
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -214,17 +214,16 @@ async def edge_fulltext_search(
for r in res['hits']['hits']: for r in res['hits']['hits']:
input_ids.append({'id': r['_source']['uuid'], 'score': r['_score']}) input_ids.append({'id': r['_source']['uuid'], 'score': r['_score']})
filter_query = filter_query + ' AND id(e)=id ' if filter_query else ' WHERE id(e)=id '
# Match the edge ids and return the values # Match the edge ids and return the values
query = ( query = (
""" """
UNWIND $ids as id UNWIND $ids as id
MATCH (n:Entity)-[e:RELATES_TO]->(m:Entity) MATCH (n:Entity)-[e:RELATES_TO]->(m:Entity)
WHERE e.group_id IN $group_ids """
AND id(e)=id + filter_query +
""" """
+ filter_query
+ """
AND id(e)=id
WITH e, id.score as score, startNode(e) AS n, endNode(e) AS m WITH e, id.score as score, startNode(e) AS n, endNode(e) AS m
RETURN RETURN
e.uuid AS uuid, e.uuid AS uuid,
@ -240,7 +239,7 @@ async def edge_fulltext_search(
e.invalid_at AS invalid_at, e.invalid_at AS invalid_at,
properties(e) AS attributes properties(e) AS attributes
ORDER BY score DESC LIMIT $limit ORDER BY score DESC LIMIT $limit
""" """
) )
records, _, _ = await driver.execute_query( records, _, _ = await driver.execute_query(