Skip to content

Commit

Permalink
Fixed codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
nick committed Apr 13, 2024
1 parent d752b7c commit f7383f6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions manticoresearch/model/search_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,13 +567,13 @@ def to_dict(self):
result['_source'] = result['source']
del result['source']
if result['aggs'] is not None:
for k,v in result['aggs'].items():
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'] = []
for k,v in result['aggs'].items():
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'] = []
if result['highlight'] is not None:
if result['highlight']['fields'] is None:
result['highlight']['fields'] = result['highlight']['fieldnames']
Expand Down
28 changes: 14 additions & 14 deletions test/test_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,20 @@ def test_manual(self):
search_request.aggs = {'agg1': agg1}
search_request.aggs['agg2'] = agg2

res = searchApi.search(search_request)
pprint(res)

compAggTerms1 = AggregationCompositeSourcesInnerValueTerms('_year')
compAgg1 = AggregationCompositeSourcesInnerValue(compAggTerms1)
compAggTerms2 = AggregationCompositeSourcesInnerValueTerms('rating')
compAgg2 = AggregationCompositeSourcesInnerValue(compAggTerms2)
compSources = {'comp_agg_1': compAgg1, 'comp_agg_2': compAgg2}
compAgg = AggregationComposite(size=5, sources=compSources)
agg = Aggregation(composite=compAgg)
search_request.aggs = {'comp_agg': agg}
res = searchApi.search(search_request)
pprint(res)
res = searchApi.search(search_request)
pprint(res)

compAggTerms1 = AggregationCompositeSourcesInnerValueTerms('_year')
compAgg1 = AggregationCompositeSourcesInnerValue(compAggTerms1)
compAggTerms2 = AggregationCompositeSourcesInnerValueTerms('rating')
compAgg2 = AggregationCompositeSourcesInnerValue(compAggTerms2)
compSources = {'comp_agg_1': compAgg1, 'comp_agg_2': compAgg2}
compAgg = AggregationComposite(size=5, sources=compSources)
agg = Aggregation(composite=compAgg)
search_request.aggs = {'comp_agg': agg}

res = searchApi.search(search_request)
pprint(res)

highlight = manticoresearch.model.Highlight()
highlight.fieldnames = ['title']
Expand Down

0 comments on commit f7383f6

Please sign in to comment.