Commit 078653a5 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Ommit quantities field n search results

parent 0c72ecd3
Pipeline #44791 passed with stages
in 24 minutes and 2 seconds
...@@ -273,6 +273,7 @@ def aggregate_search( ...@@ -273,6 +273,7 @@ def aggregate_search(
""" """
search = Search(index=config.elastic.index_name) search = Search(index=config.elastic.index_name)
if q is not None: if q is not None:
search = search.query(q) search = search.query(q)
...@@ -304,6 +305,8 @@ def aggregate_search( ...@@ -304,6 +305,8 @@ def aggregate_search(
raise KeyError('Unknown order quantity %s' % order_by) raise KeyError('Unknown order quantity %s' % order_by)
search = search.sort(order_by if order == 1 else '-%s' % order_by) search = search.sort(order_by if order == 1 else '-%s' % order_by)
search = search.source(exclude=['quantities'])
response = search[(page - 1) * per_page: page * per_page].execute() # pylint: disable=E1101 response = search[(page - 1) * per_page: page * per_page].execute() # pylint: disable=E1101
total_results = response.hits.total total_results = response.hits.total
......
...@@ -57,6 +57,7 @@ def test_search(elastic, normalized: parsing.LocalBackend): ...@@ -57,6 +57,7 @@ def test_search(elastic, normalized: parsing.LocalBackend):
assert hits[0]['calc_id'] == calc_with_metadata.calc_id assert hits[0]['calc_id'] == calc_with_metadata.calc_id
assert 'bulk' in aggs['system'] assert 'bulk' in aggs['system']
assert aggs['system']['bulk'] == 1 assert aggs['system']['bulk'] == 1
assert 'quantities' not in hits[0]
def test_authors(elastic, normalized: parsing.LocalBackend, test_user: coe_repo.User, other_test_user: coe_repo.User): def test_authors(elastic, normalized: parsing.LocalBackend, test_user: coe_repo.User, other_test_user: coe_repo.User):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment