Added indexer tests

This commit is contained in:
2026-05-23 11:38:40 +10:00
parent c1f0e48f80
commit 947626c2af
5 changed files with 276 additions and 216 deletions
+2 -3
View File
@@ -3,7 +3,7 @@ from whoosh.analysis import StemmingAnalyzer, CharsetFilter
from whoosh.support.charset import accent_map
from whoosh.fields import Schema, TEXT, KEYWORD, NUMERIC
from whoosh.qparser import QueryParser
from whoosh.query import Term, NullQuery, Prefix
from whoosh.query import Term, NullQuery, FuzzyTerm
from typing import Any
@@ -69,7 +69,6 @@ def search(
limit = NullQuery
for c in collections:
limit |= Term("collection", c)
print(limit)
hits = []
ix = get_index()
@@ -78,7 +77,7 @@ def search(
# if no results, do a prefix search
if results.results.is_empty():
qp.termclass = Prefix
qp.termclass = FuzzyTerm
q = qp.parse(query)
results = searcher.search_page(q & limit, page, pagesize)