-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get only id of result #179
Comments
OK - solved. The
|
Hey @rkrug, glad you figured it out! Another way to set library(openalexR)
q <- oa_query(search = "transformative change")
q2 <- oa_query(
search = "transformative change",
options = list(select = "id")
)
identical(paste0(q, "&select=id"), q2)
#> [1] TRUE
oa_request(q2, verbose = TRUE, count_only = TRUE)
#> $count
#> [1] 7619312
#>
#> $db_response_time_ms
#> [1] 1264
#>
#> $page
#> [1] 1
#>
#> $per_page
#> [1] 1
# or
oa_fetch(
search = "transformative change",
options = list(select = "id"),
verbose = TRUE,
count_only = TRUE
)
#> Requesting url: https://api.openalex.org/works?search=transformative%20change&select=id
#> count db_response_time_ms page per_page
#> [1,] 7619312 1264 1 1 Created on 2023-10-20 with reprex v2.0.2 |
Thanks @trangdata . Yes - that solved my issue, and also that I have to use the ampersand Although I think the |
You're probably right. We implemented |
I do not think it should be in |
@rkrug Then I think we need to think carefully about which of these parameters are "of secondary important". Currently, I'm thinking all of the parameters should be equal and moved to
So, which of these should be in Another factor to consider is the number of arguments in |
What about using the approach the grass package is taking. It has a similar problem, that it interfaces with grass (a GIS program) where each command has many different arguments. So it is a two step process:
This is not messy, flexible, in the help pages, one can mention the most important and relevant parameters and how they can be used, it is future proof, as unk known parameter can simply (with a warning) passed on to OpenAlex, etc. I think that would give the best of both worlds. The parameters of
and in the help page, mention the arguments which are hidden behind And |
@rkrug Unfortunately, the ellipses Line 62 in 5134044
Because of this, I chose to put other parameters like |
Makes sense. You know the structures much better than I do - but shouldn't it be possible to use the ellipses for both? Are there any combinations which would lead to collisions? I do not think there are any keywords for the filter in this list of parameter
So all named arguments in the ellipsis which are in this list, will be interpreted as parameter, all others will be wrapped in the filter as it is now. |
Theoretically, yes, we could do this. However, I don't know if it's best practice to try to combine different levels of parameters (filter and higher-level ones) into one I do think we need to revise how we're implementing these arguments to the query and reorganize re what should go in |
Thus us definitely the best approach for this. Sent from my iPhoneOn 20 Oct 2023, at 18:31, Trang Le ***@***.***> wrote:
Theoretically, yes, we could do this. However, I don't know if it's best practice to try to combine different levels of parameters (filter and higher-level ones) into one .... I have tried to be fancy like this many times in the past and it never came out well...
I do think we need to revise how we're implementing these arguments to the query and reorganize re what should go in options and what should be moved out. I will create a new issue for this.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I am trying to get only the OpenAlex ids of the works resulting from a search. As I sis not find this option in openalexR, I just pasted
?select=id
to the query (see https://docs.openalex.org/how-to-use-the-api/get-single-entities/select-fields).But something strange happens: the number of results changes:
Am I doing something wrong or misunderstand something, or do I have to get hold of OpenAlex?
The text was updated successfully, but these errors were encountered: