mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 13:23:15 +00:00
FIx unit tests with new search model configurations
This commit is contained in:
@@ -257,6 +257,9 @@ def get_user_search_model_or_default(user=None):
|
|||||||
|
|
||||||
if SearchModelConfig.objects.filter(name="default").exists():
|
if SearchModelConfig.objects.filter(name="default").exists():
|
||||||
return SearchModelConfig.objects.filter(name="default").first()
|
return SearchModelConfig.objects.filter(name="default").first()
|
||||||
|
else:
|
||||||
|
SearchModelConfig.objects.create()
|
||||||
|
|
||||||
return SearchModelConfig.objects.first()
|
return SearchModelConfig.objects.first()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -493,10 +493,10 @@ async def search(
|
|||||||
# Collate results
|
# Collate results
|
||||||
results += text_search.collate_results(hits, dedupe=dedupe)
|
results += text_search.collate_results(hits, dedupe=dedupe)
|
||||||
|
|
||||||
# Sort results across all content types and take top results
|
# Sort results across all content types and take top results
|
||||||
results = text_search.rerank_and_sort_results(
|
results = text_search.rerank_and_sort_results(
|
||||||
results, query=defiltered_query, rank_results=r, search_model_name=search_model.name
|
results, query=defiltered_query, rank_results=r, search_model_name=search_model.name
|
||||||
)[:results_count]
|
)[:results_count]
|
||||||
|
|
||||||
# Cache results
|
# Cache results
|
||||||
if user:
|
if user:
|
||||||
|
|||||||
Reference in New Issue
Block a user