add limit and score

This commit is contained in:
DavIvek 2025-09-10 17:32:15 +02:00
parent 489dffdc0c
commit 9cc43aeb5f
2 changed files with 2 additions and 6 deletions

View file

@ -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}})'

View file

@ -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