semanticscholar icon indicating copy to clipboard operation
semanticscholar copied to clipboard

Semantics of `limit` argument in `search_paper` seems to be wrong

Open InAnYan opened this issue 8 months ago • 5 comments

Question

For example, I want to search only 2 papers.

I wrote this code:

res = sch.search_paper('llm', bulk=True, limit=2, open_access_pdf=True)

However, len(res) returns 1000.

Shouldn't it be 2?

I've looked through the source code and found this: https://github.com/danielnsilva/semanticscholar/blob/master/semanticscholar/AsyncSemanticScholar.py#L511

max_results = 10000000 if bulk else 1000

Something's wrong here (IMHO):

  1. Shouldn't bulk be used to specify the return type: either PaginatedResults or a single Paper.
  2. Why this expression at all instead of:
max_results = limit

InAnYan avatar Mar 26 '25 17:03 InAnYan