Commit 40d8704e authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update InvenioStore to remove the obsolete method, search

parent 1da6ccd1
...@@ -191,47 +191,3 @@ class InvenioStore(BaseStore): ...@@ -191,47 +191,3 @@ class InvenioStore(BaseStore):
return obj[0] return obj[0]
raise CdsException(MSG_INVALID_RESPONSE) raise CdsException(MSG_INVALID_RESPONSE)
def search(self, query, **kwargs):
"""Return a list of *JSON record* matching search criteria.
The method is implemented for store, shelf pairs
relying on ````.
query (str):
query for the inspirehep store.
Use the syntax of the web interface or elasticsearch one.
Keyword Args:
elasticsearch keywords
* list of JSON records
* the server return an HTTP error.
* JSON object could not be decoded.
url = f"{self._api_search}{query}"
rep = self.interrogate(url, timeout=30, **kwargs)
obj = rep.json()
except ValueError:
raise CdsException(MSG_HTTP_DECODE)
# the response is a dict with 3 keys: 'hits', 'links', 'sort_options'
# the hits section is a dict with 2 keys: hits (list), total (int)
return obj["hits"]["hits"]
except (KeyError, TypeError):
raise CdsException(MSG_INVALID_RESPONSE)
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