-
Notifications
You must be signed in to change notification settings - Fork 144
Search interfaces
In Understanding the data, we explain the different elements of the data model behind Elsevier's APIs - most importantly, how authors, documents and affiliations are related. Each of these entity types also have their own search index and corresponding API; there is an API that allows you to search for documents meeting certain criteria, an API that allows you to do the same for authors, and one that allows it for affiliations.
Each of these search APIs returns, in its response, a ranked results list with records matching your search query, with for each record the most important metadata. This metadata includes a URL that you can use to instantiate and populate new document, author or affiliation objects.
The basic mechanics of sending a search request to Elsevier's APIs, and parsing results from the response you get, are the same regardless of the index you are targeting. The ElsSearch class is designed to take care of those mechanics for you; it does the 'dirty work' of constructing a valid request URL, executing the search through an ElsClient instance, and parsing the results into a Python list structure. It also automatically breaks up a search that returns many results into smaller, separate API requests that are more easily digested by Elsevier's APIs.
An ElsSearch object represents a single search query into an index and its corresponding results. Thus, when you create a search object, you will need to tell it which query it should execute and against which index - e.g.:
myDocSrch = ElsSearch('star+trek+vs+star+wars','scopus')
This example creates a search with a free-text query "star trek vs star wars" that targets the 'scopus' document index. Some other valid indexes are:
- 'author', for author profiles in Scopus
- 'affiliation', for affiliation profiles in Scopus
- 'scidir', for documents in ScienceDirect
Not all indexes accept free-text queries, and instead require specific index fields to be specified. For instance, this author search won't work:
myAuthSrch = ElsSearch('keuskamp','author')
But this one does:
myAuthSrch = ElsSearch('authlast(keuskamp)','author')
To find out which search syntax is valid for which index, look at our search tips.