sckott / habanero

client for Crossref search API

Home Page:https://habanero.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exact search for titles

Keramatfar opened this issue · comments

Thanks for your package, is it possible to search a phrase? I mean searching results with the same words and the same orders, some thing like "Islamic republic of Iran"?

Yes, I think so. See the field queries in the API docs https://api.crossref.org/swagger-ui/index.html#/Works/get_works and in habanero it's like

from habanero import Crossref
cr = Crossref()
cr.works(query_title = 'Islamic republic of Iran')
# or 
cr.works(query_bibliographic = 'Islamic republic of Iran')

Thanks, but that does not work:
[['Iran, Islamic Republic'], ['Iran, Islamic Republic'], ['Iran (Islamic Republic of)'], ['Iran (Islamic Republic of)'], ['Islamic Republic of Iran'], ['Iran (Islamic Republic of)'], ['Iran (Islamic Republic of)'], ['Iran, Islamic Republic of'], ['Iran (Islamic Republic of)'], ['Iran, Islamic Republic of'], ['Iran, Islamic Republic of'], ['Iran (Islamic Republic of)'], ['Iran (Islamic Republic of)'], ['Islamic Republic of Iran'], ['Iran (Islamic Republic of)'], ['Iran (Islamic Republic of)'], ['Iran (Islamic Republic of)'], ['Iran (Islamic Republic of)'], ['Iran, Islamic Republic of'], ['Iran (Islamic Republic of)']]

res = cr.works(query_title = 'Microglia in the Basal Ganglia of Mice')
[x['title'] for x in res['message']['items']]
will results:
[['Methylphenidate Exposure Induces Dopamine Neuron Loss and Activation of Microglia in the Basal Ganglia of Mice'], ['Basal Ganglia IV - Basal Ganglia and Ventricle'], ['Correction: Methylphenidate Exposure Induces Dopamine Neuron Loss and Activation of Microglia in the Basal Ganglia of Mice'], ['Dual Roles of Microglia in the Basal Ganglia in Parkinson’s Disease'], ['Basal Ganglia'], ['Basal Ganglia'], ['Basal Ganglia'], ['Basal Ganglia'], ['Basal Ganglia'], ['Basal Ganglia'], ['Basal Ganglia'], ['Basal ganglia'], ['Basal Ganglia'], ['Basal Ganglia'], ['Basal Ganglia'], ['Basal Ganglia'], ['Basal Ganglia'], ['Basal ganglia'], ['Basal Ganglia'], ['Basal Ganglia']]

Right, I see what you mean. As far as I know there is no way to do a search of an exact phrase. So perhaps you have to do a search, and then do the exact matching yourself within python

Good idea.