Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Require must and must not tokens to have at least 1 character trailing a +/-

davidmezzettib0763492ab7f
diff --git a/src/python/txtai/extractor.py b/src/python/txtai/extractor.py
index 75b7f18c..e9ad9283 100644
--- a/src/python/txtai/extractor.py
+++ b/src/python/txtai/extractor.py
@@ -85,8 +85,8 @@ class Extractor(object):
results = []
for query in queries:
# Get list of required and prohibited tokens
- must = [token.strip("+") for token in query.split() if token.startswith("+")]
- mnot = [token.strip("-") for token in query.split() if token.startswith("-")]
+ must = [token.strip("+") for token in query.split() if token.startswith("+") and len(token) > 1]
+ mnot = [token.strip("-") for token in query.split() if token.startswith("-") and len(token) > 1]
# Tokenize search query
query = self.tokenizer.tokenize(query)