Searching in several subcategories

212 views
Skip to first unread message

Ofer Metuki

unread,
Aug 27, 2023, 9:51:03 AM8/27/23
to arXiv API
Hi all,

I'm new to using the API, so please bear with me. I'm trying to write a simple function that queries the API and returns all papers that are categorized to at least one of a list of categories (the aim is to also be able to add a date range, but let's start with the basics). I see it's doable using the advanced search, but I haven't found any query that returns results in the API.
I've tried :
cat:cs.AI+OR+cat:cs.CL
cat:%22cs.AI+cs.AL%22
cat:%22cs.AI+OR+cs.AL%22
cat:cs.%22AI+AL%22
cat:cs.%22AI+OR+AL%22
None return any results... Can someone direct me to what I'm supposed to use for this kind of query?

Thanks,
Ofer. 

Jake Weiskoff

unread,
Aug 27, 2023, 9:55:55 AM8/27/23
to arxi...@googlegroups.com
Hi Ofer,

You need to use the cat: before each part of your query, so something more like: 


Best,
-Jake

--
You received this message because you are subscribed to the Google Groups "arXiv API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to arxiv-api+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/arxiv-api/e9e2789a-b60f-47f0-8c4a-100d6189dc1cn%40googlegroups.com.

Ofer Metuki

unread,
Aug 27, 2023, 10:05:27 AM8/27/23
to arxi...@googlegroups.com
Thanks Jake, but as you can see below that's the first thing I tried... It doesn't seem to work for the API.
Maybe I'm using it wrong? Here's my test python code:

params = {
    'search_query': 'cat:cs.AI+OR+cat:cs.CL',
    'sortBy': 'lastUpdatedDate',
    'sortOrder': 'descending',
    'start': 0
}
response = requests.get('http://export.arxiv.org/api/query', params=params)
feed = feedparser.parse(response.content)
print(len(feed.entries))

Ofer.

You received this message because you are subscribed to a topic in the Google Groups "arXiv API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/arxiv-api/GSLgAeKIDDs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to arxiv-api+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/arxiv-api/CAAx3fqSTrdCjFk3V%3DXT6V79%2ByWSEhs4nDkg4YhFdzUW9gsi6aw%40mail.gmail.com.

Jake Weiskoff

unread,
Aug 27, 2023, 11:00:37 AM8/27/23
to arxi...@googlegroups.com
Well the first thing I'd check is your url construction. If you follow the link from the url I provided above, you can see that it returns 107,163 entries in the atom response. Otherwise, be sure that your code is expecting an atom response, not something like a JSON. 

-Jake

Ofer Metuki

unread,
Aug 31, 2023, 4:31:27 AM8/31/23
to arxi...@googlegroups.com
It seems that entering some of the details as params somehow breaks it, so I switched to compiling the text query myself and it now works. Thanks!

Ofer.

Reply all
Reply to author
Forward
0 new messages