Don't add sources to query if we are allowed to see them all

This commit is contained in:
Mark Veidemanis 2022-09-05 07:20:30 +01:00
parent 667e4c475f
commit 02e1b4698d
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 481 additions and 477 deletions

View File

@ -162,8 +162,12 @@ def query_results(
sources.append(source_iter)
add_top_tmp = {"bool": {"should": []}}
total_count = 0
for source_iter in sources:
add_top_tmp["bool"]["should"].append({"equals": {"src": source_iter}})
total_count += 1
total_sources = len(settings.MANTICORE_MAIN_SOURCES) + len(settings.MANTICORE_SOURCES_RESTRICTED)
if not total_count == total_sources:
add_top.append(add_top_tmp)
# Date/time range