From ece3b7852fbe6cc111f9f35230a60c2fe96a99d3 Mon Sep 17 00:00:00 2001 From: davidmezzetti <561939+davidmezzetti@users.noreply.github.com> Date: Wed, 4 Sep 2024 12:11:43 -0400 Subject: [PATCH] Update SQL #780 --- src/python/txtai/ann/sqlite.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/python/txtai/ann/sqlite.py b/src/python/txtai/ann/sqlite.py index b8ea88478..32e22f245 100644 --- a/src/python/txtai/ann/sqlite.py +++ b/src/python/txtai/ann/sqlite.py @@ -245,9 +245,7 @@ def searchsql(self): SELECT """ - return self.tosql( - ("SELECT indexid, 1 - distance " "FROM {table} " f"WHERE embedding MATCH {self.embeddingsql()} " "ORDER BY distance " "LIMIT ?") - ) + return self.tosql(("SELECT indexid, 1 - distance FROM {table} " f"WHERE embedding MATCH {self.embeddingsql()} AND k = ? ORDER BY distance")) def countsql(self): """