From 249627c807f5c84993708f897f8633f44b3f527e Mon Sep 17 00:00:00 2001 From: Shicheng Liu Date: Tue, 7 May 2024 05:21:50 +0000 Subject: [PATCH] fix for #19 --- setup.py | 2 +- src/suql/faiss_embedding.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 84f24c9..6cb8911 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ # Package metadata name = "suql" -version = "1.1.7a2" +version = "1.1.7a3" description = "Structured and Unstructured Query Language (SUQL) Python API" author = "Shicheng Liu" author_email = "shicheng@cs.stanford.edu" diff --git a/src/suql/faiss_embedding.py b/src/suql/faiss_embedding.py index 4800819..d0a11fe 100644 --- a/src/suql/faiss_embedding.py +++ b/src/suql/faiss_embedding.py @@ -301,6 +301,8 @@ def dot_product(self, id_list, query, top, individual_id_list=[]): params=faiss.SearchParametersIVF(sel=sel), ) else: + if top > self.embeddings.ntotal: + top = self.embeddings.ntotal D, I = self.embeddings.search( query_embedding, top, params=faiss.SearchParametersIVF(sel=sel) )