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

Query returning 0 results #66

Closed
imaa9 opened this issue Aug 18, 2018 · 17 comments
Closed

Query returning 0 results #66

imaa9 opened this issue Aug 18, 2018 · 17 comments
Milestone

Comments

@imaa9
Copy link

imaa9 commented Aug 18, 2018

rvertnet query returns 0 results, can't figure out what the bug is. Here, replaced my functioning email with a dummy email.

bigsearch(genus = "anolis",
year = c(">1900", "<2018"),
county = "jamaica",
email = "[email protected]",
rfile = "JamaicanSpecimenRecords")


@sckott
Copy link
Contributor

sckott commented Aug 20, 2018

thanks @imaa9 ! can you share the output of sessionInfo() please?

@sckott
Copy link
Contributor

sckott commented Aug 20, 2018

you wrote county above in your code sample. did you mean to write country?

@imaa9
Copy link
Author

imaa9 commented Aug 20, 2018

ah! thanks @sckott !

@imaa9 imaa9 closed this as completed Aug 20, 2018
@imaa9 imaa9 reopened this Aug 20, 2018
@imaa9
Copy link
Author

imaa9 commented Aug 20, 2018

Even after correcting the "county" field to "country", the search returned zero matches.
Changed "anolis" to "Anolis", which seems to have solved the problem (search is not immediately returning 0 results and is likely running), so it appears that the "genus" field is case-sensitive.

@imaa9 imaa9 closed this as completed Aug 20, 2018
@sckott sckott reopened this Aug 20, 2018
@sckott
Copy link
Contributor

sckott commented Aug 20, 2018

thanks for the update. i'll make sure the documentation says it's case sensitive

@sckott sckott modified the milestones: v1.0, v0.8 Aug 20, 2018
@sckott
Copy link
Contributor

sckott commented Aug 20, 2018

@imaa9 So there's three issues here:

  1. the parameter for country is cntry and not country. I can't remember why we did that, but anyway there it is. so when you were doing country = "jamaica" it wasn't being sent. I think we changed it to cntry because R does partial matching of parameters passed to functions and there's also a county parameter, so if you just give e.g., count that could match county or country

  2. I don't think genus is case sensitive because I was able to get the same results for genus="anolis" and genus="Anolis"

screen shot 2018-08-20 at 2 46 14 pm

screen shot 2018-08-20 at 2 46 09 pm

  1. Sometimes the vertnet servers just fail to give results (when results should be given) for no reason. so if you are pretty confident you haven't specfied the query incorrectly I'd just try again, and if still doesn't work after many tries then let us know. For example, here's the exact same query that gives 0 results, then when done 1 minute later gives many results

screen shot 2018-08-20 at 2 48 17 pm

screen shot 2018-08-20 at 2 48 20 pm

let me know if you have any further questions.

@imaa9
Copy link
Author

imaa9 commented Aug 20, 2018

Thanks a lot @sckott!
This is very helpful. I ended up just specifying the species I wanted (7 of them, all endemic to Jamaica), and in that way got around needing to ask for country. Is there a way to query multiple species? I managed to do it for 2
bigsearch(genus = "(Anolis OR Norops)", specificepithet = "(grahami OR garmani)", year = c(">1900", "<2018"), email = "[email protected]", rfile = "GrahamiGarmani")

but when I tried to expand this
specificepithet = "(grahami OR garmani OR opalinus OR lineatopus OR valencienni)",

I got 0 results back. Maybe it was a server crash, but wondering whether this is the correct syntax.

@sckott
Copy link
Contributor

sckott commented Aug 20, 2018

I don't know if there's a way to do multiple species other than the way you showed above. The documentation for the API is here https://github.com/VertNet/webapp/wiki/The-API-search-function with examples and such

@ptitle
Copy link

ptitle commented Oct 7, 2019

Hi @sckott ,
I don't know that the issue is the same as above, but I am also getting zero records returned for queries that should be returning lots of records. To use an example, the following appears to work as expected:

> res <- searchbyterm(class = "Aves", state = "California", lim = 10)
Processing request...

Last Query URL: "http://api.vertnet-portal.appspot.com/api/search?q=%7B%22q%22%3A%22class%3AAves%20stateprovince%3ACalifornia%22%2C%22l%22%3A10%7D"

Matching records: 10 returned, >10000 available

But the following 2 queries return no records:

> res <- searchbyterm(class = "Aves", state = "California", type='specimen', lim = 10)
Processing request...

Last Query URL: "http://api.vertnet-portal.appspot.com/api/search?q=%7B%22q%22%3A%22class%3AAves%20stateprovince%3ACalifornia%20type%3Aspecimen%22%2C%22l%22%3A10%7D"

Matching records: 0 returned, 0 available
No records match this search request

or

> res <- searchbyterm(class = "Aves", state = "California", tissue=TRUE, lim = 10)
Processing request...

Last Query URL: "http://api.vertnet-portal.appspot.com/api/search?q=%7B%22q%22%3A%22class%3AAves%20stateprovince%3ACalifornia%20tissue%3A1%22%2C%22l%22%3A10%7D"

Matching records: 0 returned, 0 available
No records match this search request

Am I doing something wrong?

thanks!

@sckott
Copy link
Contributor

sckott commented Oct 8, 2019

looks like the parameter names have changed, working on a fix

@sckott sckott closed this as completed in 0aba78e Oct 10, 2019
@sckott
Copy link
Contributor

sckott commented Oct 10, 2019

@ptitle can you reinstall remotes::install_github("ropensci/rvernet"), restart R, and try again

@sckott
Copy link
Contributor

sckott commented Oct 10, 2019

note that the setup has changed. I realized that there are a ton of parameters one can use, and thought it was easiest to simplify the function so that each parameter is no longer defined in the function definition, but you are allowed to pass in any parameters that Vertnet allows - when you install and load the new version see the section Parameters in the docs for ?searchbyterm

@ptitle
Copy link

ptitle commented Oct 10, 2019

Thanks @sckott ! I installed again from github, as specified.

Ok, trying the same test:

> res <- searchbyterm(class = "Aves", state = "California", lim = 10)
Processing request...

Last Query URL: "http://api.vertnet-portal.appspot.com/api/search?q=%7B%22q%22%3A%22class%3AAves%22%2C%22l%22%3A1000%7D"

Matching records: 1000 returned, >10000 available

So far so good... but the other tests that didn't work before still don't work, assuming I am specifying the correct arguments:

> res <- searchbyterm(class = "Aves", state = "California", basisofrecord = 'PreservedSpecimen', lim = 10)
Processing request...

Last Query URL: "http://api.vertnet-portal.appspot.com/api/search?q=%7B%22q%22%3A%22class%3AAves%20basisofrecord%3APreservedSpecimen%22%2C%22l%22%3A1000%7D"

Matching records: 0 returned, 0 available
No records match this search request

and

> res <- searchbyterm(class = "Aves", state = "California", hastissue=TRUE, lim = 10)
Processing request...

Last Query URL: "http://api.vertnet-portal.appspot.com/api/search?q=%7B%22q%22%3A%22class%3AAves%20hastissue%3Atrue%22%2C%22l%22%3A1000%7D"

Matching records: 0 returned, 0 available
No records match this search request

or

> res <- searchbyterm(class = "Aves", state = "California", mappable=TRUE, lim = 10)
Processing request...

Last Query URL: "http://api.vertnet-portal.appspot.com/api/search?q=%7B%22q%22%3A%22class%3AAves%20mappable%3Atrue%22%2C%22l%22%3A1000%7D"

Matching records: 0 returned, 0 available
No records match this search request

sckott added a commit that referenced this issue Oct 10, 2019
…ng about no results

fix #67 URLdecode url before printing url so users can more easily determine if the query they sent is what they expect
bump version
@sckott
Copy link
Contributor

sckott commented Oct 10, 2019

So with the change, now you have to give the parameters exactly as Vertnet expects them. In the previous version, partial matching was done, so state would match the actual parameter stateprovince, and lim would match limit. I really don't like this behavior, so I've removed it. I think it's best to be explicit (similar to always use TRUE/FALSE instead of T/F). the docs for searchbyterm give all the parameter names

If you look at the URLs from the searches printed as above you can see the difference (e.g.., if you give state vs. stateprovince; state will be dropped silently as it doesn't match expected parameters). I just changed (reinstall again) so that the URL is now more human readable.

Another aspect, and I just updated the docs for this (can get on the reinstall), is that Vertnet for some reason will return no/zero results for a query on one function call, but return results 10 seconds later with the same exact function call. I've no idea why this happens, but it does. So if you get no results for a query youd expect results, try again a number of times, and if still no results, maybe there really aren't any, or the parameters aren't specified correctly.

@ptitle
Copy link

ptitle commented Oct 10, 2019

Hi @sckott ,
Inclusion of a readable URL is really helpful, as I can be sure that I'm using reasonable flags now. Thanks for that.

The following queries still don't return anything, but the URLs appear to indicate that I'm specifying things correctly, and I've tried the queries multiple times. But these are searches that really should be returning records.

> res <- searchbyterm(class = "Aves", stateprovince = "California", hastissue=TRUE, limit = 10)
Processing request...

Last Query URL: "http://api.vertnet-portal.appspot.com/api/search?q={"q":"class:Aves hastissue:true stateprovince:California","l":10}"

Matching records: 0 returned, 0 available
No records match this search request

or

> res <- searchbyterm(class = "Aves", stateprovince = "California", mappable=TRUE, limit = 10)
Processing request...

Last Query URL: "http://api.vertnet-portal.appspot.com/api/search?q={"q":"class:Aves mappable:true stateprovince:California","l":10}"

Matching records: 0 returned, 0 available
No records match this search request

Are you getting these results on your end?

thanks!

@sckott
Copy link
Contributor

sckott commented Oct 10, 2019

haha! in the change, I forgot to make sure all params that are booleans were converted to Vertnet's expected 0/1 instead of true/false - should be fixed now, reinstall

@ptitle
Copy link

ptitle commented Oct 10, 2019

Ok, that's much better. Thanks for the quick responses!

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

3 participants