Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
c02e9993
Commit
c02e9993
authored
Jan 13, 2021
by
LE GAC Renaud
Browse files
Update InspireHepStore.search_parameter to add parenthesis
parent
0df11386
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
modules/store_tools/inspirehepstore.py
modules/store_tools/inspirehepstore.py
+21
-10
No files found.
modules/store_tools/inspirehepstore.py
View file @
c02e9993
...
...
@@ -254,31 +254,42 @@ class InspirehepStore(BaseStore):
Args:
collection (str):
the collection in the store
, *e.g.* ``LHCb Papers``.
the collection in the store
:
* find cn d0 and tc p and not tc c
* find cc HAL Hidden a simpson
, g
and not tc c
* find cc HAL Hidden a
g
simpson and not tc c
* other syntax accept by inspirehep.net search engine
year_start (str):
select publication published for the given year
year_end (str):
select publication published between year_start and
year_end included.
Returns:
dict:
"""
query
=
collection
# add parenthesis
# see https://inspirehep.net/help/knowledge-base/inspire-paper-search/
if
collection
.
startswith
(
"find"
):
collection
=
collection
.
replace
(
"find "
,
"find ("
)
+
")"
else
:
collection
=
f
"(
{
collection
}
)"
# add year(s) criteria
if
year_start
and
not
year_end
:
query
+
=
f
" and date
{
year_start
}
"
query
=
f
"
{
collection
}
and date
{
year_start
}
"
elif
not
year_start
and
year_end
:
query
+
=
f
" and date
{
year_end
}
"
query
=
f
"
{
collection
}
and date
{
year_end
}
"
elif
year_start
and
year_end
:
tpl
=
(
f
"date
{
el
}
"
for
el
in
range
(
year_start
,
year_end
+
1
))
sdates
=
" or "
.
join
(
tpl
)
query
+=
f
" and (
{
sdates
}
)"
query
=
f
"
{
collection
}
and date
{
year_start
}
->
{
year_end
}
"
else
:
query
=
collection
#
g
et
100 records
per page
#
s
et
the number of record to 100
per page
return
dict
(
q
=
query
,
size
=
100
)
Write
Preview
Markdown
is supported
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