Skip to content

Commit

Permalink
fixed the facet_limit for WFT
Browse files Browse the repository at this point in the history
  • Loading branch information
sweng66 committed Feb 7, 2025
1 parent 32a7a65 commit 37e7d9d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions agr_literature_service/api/crud/search_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def search_references(query: str = None, facets_values: Dict[str, List[str]] = N
"terms": {
"field": "workflow_tags.workflow_tag_id.keyword",
"min_doc_count": 0,
"size": facets_limits.get("workflow_tags.workflow_tag_id.keyword", 10)
"size": 100
}
}
},
Expand Down Expand Up @@ -438,6 +438,8 @@ def process_search_results(res): # pragma: no cover

# convert to the required format (like 'topics')
for category, buckets in grouped_workflow_tags.items():
filtered_buckets = [b for b in buckets if b["doc_count"] > 0]
sorted_buckets = sorted(filtered_buckets, key=lambda x: x["doc_count"], reverse=True)
res['aggregations'][category] = {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
Expand All @@ -447,7 +449,7 @@ def process_search_results(res): # pragma: no cover
"doc_count": bucket["doc_count"],
"name": bucket.get("name", bucket["key"])
}
for bucket in buckets
for bucket in sorted_buckets
]
}

Expand Down

0 comments on commit 37e7d9d

Please sign in to comment.