Commit cb34d638 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update Automaton to build the cc keywork when running with inspirehep.

parent 956e8dff
......@@ -28,6 +28,10 @@ MSG_NSERT_FAIL = "Fail to insert the new record in the database."
MSG_NO_OAI = "Reject no OAI identifier"
MSG_WELL_FORM_OAI = "Reject OAI is not well formed"
# search collection when using inspirehep
# require for "Hal Hidden"
REG_COLLECTION = re.compile(r"cc([A-Za-z ]+)(and|$)")
class Automaton(object):
"""Base class to search and process publications:
......@@ -299,6 +303,15 @@ class Automaton(object):
sf='year', # sort by date
so='d') # descending order
# handle the cc keyword (true inspirehep collection)
match = REG_COLLECTION.search(query)
if match:
dic["cc"] = match.group(1).strip()
dic["p"] = REG_COLLECTION.sub("", query).strip()
dic["p"] = dic["p"].replace(" ", " ")
if dic["p"] == "find":
del dic["p"]
# CERN INVENIO store
else:
......
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