AtlasOfLivingAustralia / galah-R

Query living atlases from R
https://galah.ala.org.au
38 stars 3 forks source link

`search_taxa()` does not find the correct genus for some search terms #194

Open cjwaite23 opened 1 year ago

cjwaite23 commented 1 year ago

Describe the bug When using search_taxa(), some genera are not found until including a second word. This bug doesn't happen for many common genera I've tried like Dacelo, but occurs when I try less common genera.

galah version 1.5.2

To Reproduce Take, for example, the flea genus Ips, the nematode genus Bursaphelenchus, or the flea beetle genus Phyllotreta. When searched with search_taxa with just the raw character string, an error is returned due to the presence of homonyms. i.e. set either genus <- "Ips", genus <- "Bursaphelenchus" or genus <- "Phyllotreta". > search_taxa(genus) The function returns the message No taxon matches were found for "Phyllotreta" in the selected atlas (Australia)..

To avoid the homonym issue we can try to specify that we wish to search for genus, but again we receive the same message of no taxon matches, but this time without any error or homonym messages/warnings. > search_taxa(tibble(genus = genus))

However, if we add a space and then any string at all (a species name, "spp." or randomly pressed keys) after the search term here, then the requested genus will be found: e.g. > search_taxa(tibble(genus = "Ips spp.")) > search_taxa(tibble(genus = "Bursaphelenchus hunensis")) > search_taxa(tibble(genus = "Phyllotreta lauyedfvkwusgdfkgv"))

Expected behaviour While the homonym error is generally expected for some more obscure species and genus names, it is unexpected that a search for the exact correct string when specificed as genus is not enough to identify the correct classification. We would expect that a call of the form search_taxa(tibble(genus = genus)) would work in all instances, not just for select genera. Expected behaviour is observed for bird and other insect genera, for instance search_taxa(tibble(genus = "Dacelo")) and search_taxa(tibble(genus = "Bombus")).