From fb8db9ddace8eceab727fe2752bfdf784ffddd23 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:03:40 +0000 Subject: [PATCH 1/3] Bump redis from 4.5.1 to 4.5.4 Bumps [redis](https://github.com/redis/redis-py) from 4.5.1 to 4.5.4. - [Release notes](https://github.com/redis/redis-py/releases) - [Changelog](https://github.com/redis/redis-py/blob/master/CHANGES) - [Commits](https://github.com/redis/redis-py/compare/v4.5.1...v4.5.4) --- updated-dependencies: - dependency-name: redis dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 14208fcf..f6024322 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ pytz==2021.1 PyYAML==6.0 requests==2.31.0 # old redis==4.4.2 -redis==4.5.1 +redis==4.5.4 requests-cache==0.9.8 six==1.16.0 From e27384b0dc8c54e9ac35f0a5758e9ffd68a57777 Mon Sep 17 00:00:00 2001 From: YaphetKG Date: Wed, 28 May 2025 15:45:12 -0400 Subject: [PATCH 2/3] counting things --- src/dug/server.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dug/server.py b/src/dug/server.py index 58a151c9..5784cc94 100644 --- a/src/dug/server.py +++ b/src/dug/server.py @@ -295,8 +295,10 @@ def sort_inner_dicts(data: Dict[str, Dict[str, int]]) -> Dict[str, Dict[str, int # --- 9. Return Final Response --- # Return the *fully filtered* variables and the *faceted* aggregation counts return { - "variables": filtered_variables_for_response, # Variables filtered by ALL criteria - "agg_counts": sorted_agg_counts # Aggregations calculated facet-style + "variables": filtered_variables_for_response if search_query.size > 0 else [], # Variables filtered by ALL criteria + "agg_counts": {k: [{"key": i, "doc_count": v} + for i, v in sorted_agg_counts[k].items()] for k in sorted_agg_counts}, # Aggregations calculated facet-style + "total": len(filtered_variables_for_response) } From 028bf239e1cf0803cedf1d042d3632fc075e08f0 Mon Sep 17 00:00:00 2001 From: YaphetKG Date: Wed, 28 May 2025 15:47:00 -0400 Subject: [PATCH 3/3] if size is zero return everything --- src/dug/core/async_search.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dug/core/async_search.py b/src/dug/core/async_search.py index 9ea570bb..c08ae2ba 100644 --- a/src/dug/core/async_search.py +++ b/src/dug/core/async_search.py @@ -216,7 +216,7 @@ def _get_concepts_query(query, fuzziness=1, prefix_length=3): } } return query_object - + def is_simple_search_query(self, query): return "*" in query or "\"" in query or "+" in query or "-" in query @@ -293,7 +293,7 @@ async def search_variables(self, concept="", query="", size=None, es_query = self.get_simple_variable_search_query(concept, query) else: es_query = self._get_var_query(concept, fuzziness, prefix_length, query) - + if index is None: index = "variables_index" @@ -304,7 +304,7 @@ async def search_variables(self, concept="", query="", size=None, filter_path=['hits.hits._id', 'hits.hits._type', 'hits.hits._source', 'hits.hits._score'], from_=offset, - size=size + size=size or total_items['count'] ) search_result_hits = []