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
af03e528
Commit
af03e528
authored
Jul 28, 2020
by
Markus Scheidgen
Browse files
Allow deeply nested search quantities.
parent
ca5dbe12
Changes
2
Show whitespace changes
Inline
Side-by-side
nomad/metainfo/elastic_extension.py
View file @
af03e528
...
@@ -153,8 +153,9 @@ class ElasticDocument(SectionAnnotation):
...
@@ -153,8 +153,9 @@ class ElasticDocument(SectionAnnotation):
# create an field for each sub section
# create an field for each sub section
for
sub_section
in
section
.
all_sub_sections
.
values
():
for
sub_section
in
section
.
all_sub_sections
.
values
():
sub_sectoin_prefix
=
'%s.%s'
%
(
prefix
,
sub_section
.
name
)
if
prefix
else
sub_section
.
name
inner_document
=
ElasticDocument
.
create_document
(
inner_document
=
ElasticDocument
.
create_document
(
sub_section
.
sub_section
,
inner_doc
=
True
,
prefix
=
sub_sect
ion
.
name
)
sub_section
.
sub_section
,
inner_doc
=
True
,
prefix
=
sub_sect
oin_prefix
)
if
inner_document
is
not
None
:
if
inner_document
is
not
None
:
# sub sections with no elastic quantities get a None document
# sub sections with no elastic quantities get a None document
attrs
[
sub_section
.
name
]
=
Object
(
inner_document
)
attrs
[
sub_section
.
name
]
=
Object
(
inner_document
)
...
...
nomad/metainfo/search_extension.py
View file @
af03e528
...
@@ -125,7 +125,6 @@ class Search(Elastic):
...
@@ -125,7 +125,6 @@ class Search(Elastic):
super
().
init_annotation
(
definition
)
super
().
init_annotation
(
definition
)
def
register
(
self
,
prefix
,
field
):
def
register
(
self
,
prefix
,
field
):
# TODO support more deeply nested quantities
domain_or_all
=
self
.
definition
.
m_parent
.
m_get_annotations
(
'domain'
,
'__all__'
)
domain_or_all
=
self
.
definition
.
m_parent
.
m_get_annotations
(
'domain'
,
'__all__'
)
prefix_and_dot
=
prefix
+
'.'
if
prefix
is
not
None
else
''
prefix_and_dot
=
prefix
+
'.'
if
prefix
is
not
None
else
''
...
...
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