From 7e08f6f696f407a6de2f0f58b22b6acd38568e6f Mon Sep 17 00:00:00 2001 From: nick Date: Sat, 13 Apr 2024 16:18:31 +0700 Subject: [PATCH] Updated tests --- docs/SearchRequest.md | 2 +- manticoresearch/model/search_request.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/SearchRequest.md b/docs/SearchRequest.md index 88dd317..c12a036 100644 --- a/docs/SearchRequest.md +++ b/docs/SearchRequest.md @@ -152,7 +152,7 @@ Name | Type | Description | Notes compAgg1 = AggregationCompositeSourcesInnerValue(compAggTerms1) compAggTerms2 = AggregationCompositeSourcesInnerValueTerms('rating') compAgg2 = AggregationCompositeSourcesInnerValue(compAggTerms2) - compSources = {'comp_agg_1': compAgg1, 'comp_agg_2': compAgg2} + compSources = [{'comp_agg_1': compAgg1}, {'comp_agg_2': compAgg2}] compAgg = AggregationComposite(size=5, sources=compSources) agg = Aggregation(composite=compAgg) diff --git a/manticoresearch/model/search_request.py b/manticoresearch/model/search_request.py index 13f964b..c3e3995 100644 --- a/manticoresearch/model/search_request.py +++ b/manticoresearch/model/search_request.py @@ -568,12 +568,10 @@ def to_dict(self): del result['source'] if result['aggs'] is not None: for k,v in result['aggs'].items(): + if v['composite'] is not None: + del result['aggs'][k]['terms'] if v['sort'] is None: - result['aggs'][k]['sort'] = [] - if v['terms'] is None: - result['aggs'][k]['terms'] = [] - if v['composite'] is None: - result['aggs'][k]['composite'] = [] + del result['aggs'][k]['sort'] if result['highlight'] is not None: if result['highlight']['fields'] is None: result['highlight']['fields'] = result['highlight']['fieldnames']