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