diff --git a/lightrag/kg/postgres_impl.py b/lightrag/kg/postgres_impl.py index c1ca7aa9..b0284e91 100644 --- a/lightrag/kg/postgres_impl.py +++ b/lightrag/kg/postgres_impl.py @@ -1597,7 +1597,7 @@ SQL_TEMPLATES = { SELECT id, 1 - (content_vector <=> '[{embedding_string}]'::vector) as distance FROM LIGHTRAG_DOC_CHUNKS where workspace=$1 - AND chunk_id IN (SELECT chunk_id FROM relevant_chunks) + AND id IN (SELECT chunk_id FROM relevant_chunks) ) WHERE distance>$2 ORDER BY distance DESC diff --git a/lightrag/operate.py b/lightrag/operate.py index 7910917a..4d440ca5 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -892,7 +892,8 @@ async def mix_kg_vector_query( try: # Reduce top_k for vector search in hybrid mode since we have structured information from KG mix_topk = min(10, query_param.top_k) - results = await chunks_vdb.query(augmented_query, top_k=mix_topk) + # TODO: add ids to the query + results = await chunks_vdb.query(augmented_query, top_k=mix_topk, ids = query_param.ids) if not results: return None