Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/dug/core/async_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"

Expand All @@ -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 = []
Expand Down
6 changes: 4 additions & 2 deletions src/dug/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}


Expand Down
Loading