💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
Require sparse keyword/vector scores to be greater than 0, closes #941
davidmezzettida5baa247932
diff --git a/src/python/txtai/embeddings/search/base.py b/src/python/txtai/embeddings/search/base.pyindex 9461c74e..22199e0c 100644--- a/src/python/txtai/embeddings/search/base.py+++ b/src/python/txtai/embeddings/search/base.py@@ -189,7 +189,7 @@ class Search:def sparse(self, queries, limit):"""- Executes a sparse vector search with a term frequency sparse array.+ Executes a sparse vector search with a sparse keyword or sparse vector index.Args:queries: list of queries@@ -199,8 +199,13 @@ class Search:list of (id, score) per query"""- # Search term frequency sparse index- return self.resolve(self.scoring.batchsearch(queries, limit))+ # Search sparse index+ results = self.scoring.batchsearch(queries, limit)++ # Require scores to be greater than 0+ results = [[(i, score) for i, score in r if score > 0] for r in results]++ return self.resolve(results)def resolve(self, results):"""