Skip to content
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

enable exclusion queries #238

Open
aappling-usgs opened this issue Jul 5, 2017 · 0 comments
Open

enable exclusion queries #238

aappling-usgs opened this issue Jul 5, 2017 · 0 comments

Comments

@aappling-usgs
Copy link
Contributor

ScienceBase lets you explicitly exclude items that match criteria; see "Exclude Elements in Search Results" in https://www.sciencebase.gov/about/content/sciencebase-advanced-search. It would be great if this were also possible through sbtools, but if it is already possible, I can't figure out how to do it.

Using my browser directly,
https://www.sciencebase.gov/catalog/items?q=&lq=flood%20AND%20earthquake currently returns 62 results while
https://www.sciencebase.gov/catalog/items?q=&lq=flood%20AND%20earthquake&filter=browseCategory!%3DPublication returns 7 results

Using sbtools, I don't know how to get my 7 results. Here's what I can get:

> length(query_sb(query_list = list(q = '', lq = 'flood AND earthquake'), limit=100))
[1] 62
> length(query_sb(query_list = list(q = '', lq = 'flood AND earthquake', 'browseCategory' = "Publication"), limit=100))
[1] 55
> length(query_sb(query_list = list(q = '', lq = 'flood AND earthquake', 'browseCategory!' = "Publication"), limit=100))
[1] 62
> length(query_sb(query_list = list(q = '', lq = 'flood AND earthquake', 'browseCategory' = "!Publication"), limit=100))
[1] 0

The 3rd and 4th queries above get converted into these URLs within httr::GET:
query_sb(query_list = list(q = '', lq = 'flood AND earthquake', 'browseCategory!' = "Publication"), limit=100) -> https://www.sciencebase.gov/catalog/items/?q=&lq=flood%20AND%20earthquake&browseCategory%21=Publication&s=Search&format=json&fields=id%2Ctitle%2CparentId%2CdateCreated%2ClastUpdated%2CcreatedBy%2ClastUpdatedBy%2Cfiles&max=100
query_sb(query_list = list(q = '', lq = 'flood AND earthquake', 'browseCategory' = "!Publication") -> https://www.sciencebase.gov/catalog/items/?q=&lq=flood%20AND%20earthquake&s=Search&format=json&fields=id%2Ctitle%2CparentId%2CdateCreated%2ClastUpdated%2CcreatedBy%2ClastUpdatedBy%2Cfiles&max=100&filter=browseCategory%3D%21Publication

It appears that the ! comes closest to the right position with 'browseCategory!'=..., but it gets converted into %21 and so loses its intended effect.

So. Is exclusion already possible using some other syntax? If not, could it be made possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant