Skip to content

Reduce number of API calls for large filters #349

@Bisaloo

Description

@Bisaloo

openalexR will split large filters in multiple requests of 50 values:

openalexR/R/oa_fetch.R

Lines 114 to 125 in e116c3e

# overcome OA limitation of combining 50 values (OR) for a filter at a time
# https://docs.openalex.org/how-to-use-the-api/get-lists-of-entities/filter-entity-lists#addition-or
# here, we assume there is only ONE "large" filter
large_filter <- which(lengths(filter) > 50)
if (length(large_filter) == 0) {
list_id <- list(`1` = NULL)
} else {
list_id <- split(
filter[[large_filter]],
ceiling(seq_along(filter[[large_filter]]) / 50)
)
}

However, it seems that the limit of 50 was raised to 100 last year (or at least the docs were updated at that time):

ourresearch/openalex-docs@db68a28

Could openalexR be updated to reflect this so the number of API calls can be cut in half?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions