ropenscilabs / deposits

R Client for access to multiple data repository services
https://docs.ropensci.org/deposits/
Other
37 stars 3 forks source link

deposits_search does not accept `search_for` in figshare #89

Closed LukasWallrich closed 10 months ago

LukasWallrich commented 10 months ago

The title says it all - while search_for is a documented figshare parameter, I get:

cli$deposits_search(search_for = "intergroup contact", item_type = 3) Error: The parameters [search_for] are not figshare search parameters; see ?depositsClient for full list.

mpadge commented 10 months ago

That's because the Figshare search_for parameter is the "Search Term", and that is defined for deposits searches as the default first string of deposits_search(), and called there "search_string". Explicit setting of "search_for" on Figshare has thus been disabled here. This works:

cli$deposits_search(search_term = "intergroup contact", item_type = 3)

or simply

cli$deposits_search("intergroup contact", item_type = 3)

Your confusion nevertheless indicates that the error messages there are not sufficiently informative, so I'll update that now, and show you what it looks like. Thanks!

mpadge commented 10 months ago

Actually, it was even easier to simply make search_for work, but to ensure that only one term is specified:

library (deposits)
packageVersion ("deposits")
#> [1] '0.2.1.44'
cli <- depositsClient$new (service = "figshare")
txt <- "intergroup contact"
x <- cli$deposits_search (search_for = txt, item_type = 3) # works
x <- cli$deposits_search (search_string = txt, item_type = 3) # works
x <- cli$deposits_search (search_string = txt, search_for = txt, item_type = 3)
#> Error: Please specify only one of 'search_for' or 'search_string'.

Created on 2023-11-06 with reprex v2.0.2

Does that solve your problem?

LukasWallrich commented 10 months ago

Yes, that seems ideal. Thank you!