From 9cc43aeb5f982a8e963970f69e0b4c03049354ee Mon Sep 17 00:00:00 2001 From: DavIvek Date: Wed, 10 Sep 2025 17:32:15 +0200 Subject: [PATCH] add limit and score --- graphiti_core/graph_queries.py | 4 ++-- graphiti_core/search/search_utils.py | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/graphiti_core/graph_queries.py b/graphiti_core/graph_queries.py index ffee09f2..7ecafeca 100644 --- a/graphiti_core/graph_queries.py +++ b/graphiti_core/graph_queries.py @@ -140,7 +140,7 @@ def get_nodes_query(name: str, query: str, limit: int, provider: GraphProvider) return f"CALL QUERY_FTS_INDEX('{label}', '{name}', {query}, TOP := $limit)" if provider == GraphProvider.MEMGRAPH: - return f'CALL text_search.search_all("{name}", {query})' + return f'CALL text_search.search_all("{name}", {query}, {limit})' return f'CALL db.index.fulltext.queryNodes("{name}", {query}, {{limit: $limit}})' @@ -169,6 +169,6 @@ def get_relationships_query(name: str, limit: int, provider: GraphProvider) -> s return f"CALL QUERY_FTS_INDEX('{label}', '{name}', cast($query AS STRING), TOP := $limit)" if provider == GraphProvider.MEMGRAPH: - return f'CALL text_search.search_all_edges("{name}", $query)' + return f'CALL text_search.search_all_edges("{name}", $query, {limit})' return f'CALL db.index.fulltext.queryRelationships("{name}", $query, {{limit: $limit}})' diff --git a/graphiti_core/search/search_utils.py b/graphiti_core/search/search_utils.py index ff08239d..9bce2e3f 100644 --- a/graphiti_core/search/search_utils.py +++ b/graphiti_core/search/search_utils.py @@ -562,8 +562,6 @@ async def node_fulltext_search( yield_query = 'YIELD node AS n, score' if driver.provider == GraphProvider.KUZU: yield_query = 'WITH node AS n, score' - elif driver.provider == GraphProvider.MEMGRAPH: - yield_query = ' YIELD node AS n WITH n, 1.0 AS score' if driver.provider == GraphProvider.NEPTUNE: res = driver.run_aoss_query('node_name_and_summary', query, limit=limit) # pyright: ignore reportAttributeAccessIssue @@ -970,8 +968,6 @@ async def community_fulltext_search( yield_query = 'YIELD node AS c, score' if driver.provider == GraphProvider.KUZU: yield_query = 'WITH node AS c, score' - elif driver.provider == GraphProvider.MEMGRAPH: - yield_query = ' WITH node AS c, 1.0 AS score' # Memgraph: continue from YIELD node if driver.provider == GraphProvider.NEPTUNE: res = driver.run_aoss_query('community_name', query, limit=limit) # pyright: ignore reportAttributeAccessIssue