Commit 6adcbb7e authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update Automaton._search_parameters to improve dates handling for inspirehep.

parent 21d028a5
......@@ -321,14 +321,15 @@ class Automaton(object):
query = collection
if year_start and not year_end:
query += " and date %s" % year_start
query += f" and date {year_start}"
elif not year_start and year_end:
query += " and date %s" % year_end
query += f" and date {year_end}"
elif year_start and year_end:
query += " and date > %s and date < %s " \
% (year_start - 1, year_end + 1)
tpl = (f"date {el}" for el in range(year_start, year_end + 1))
sdates = " or ".join(tpl)
query += f" and ({sdates})"
dic = dict(p=query, # query à la spires
rg=1000, # maximum number of records returned
......@@ -354,8 +355,8 @@ class Automaton(object):
rex = year_end
elif year_start and year_end:
li = [str(el) for el in range(year_start, year_end + 1)]
rex = "|".join(li)
tpl = (str(el) for el in range(year_start, year_end + 1))
rex = "|".join(tpl)
dic = dict(cc=collection, # collection
f1="year", # search on year
......
Markdown is supported
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