Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
078653a5
Commit
078653a5
authored
Mar 06, 2019
by
Markus Scheidgen
Browse files
Ommit quantities field n search results
parent
0c72ecd3
Pipeline
#44791
passed with stages
in 24 minutes and 2 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nomad/search.py
View file @
078653a5
...
...
@@ -273,6 +273,7 @@ def aggregate_search(
"""
search
=
Search
(
index
=
config
.
elastic
.
index_name
)
if
q
is
not
None
:
search
=
search
.
query
(
q
)
...
...
@@ -304,6 +305,8 @@ def aggregate_search(
raise
KeyError
(
'Unknown order quantity %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
total_results
=
response
.
hits
.
total
...
...
tests/test_search.py
View file @
078653a5
...
...
@@ -57,6 +57,7 @@ def test_search(elastic, normalized: parsing.LocalBackend):
assert
hits
[
0
][
'calc_id'
]
==
calc_with_metadata
.
calc_id
assert
'bulk'
in
aggs
[
'system'
]
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
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment