Issues with all_names on /v1/taxa/autocomplete

@pleury there may be a problem here with the new all_names result:

The web has this for Snowy Owl: https://www.inaturalist.org/taxa/144594-Bubo-scandiacus

Icelandic Snæugla

But all_names returns this corresponding entry with “locale”: “und” (“undefined”, i guess?) Is that true for that entry, or is this a bug? I see the AOU code entry “SNOW” has “und”, too, but I expected that.

        {
          "is_valid": true,
          "name": "Snæugla",
          "position": 11,
          "locale": "und"
        },

Here’s the URL to match just Snowy Owl with all_names=1:

https://api.inaturalist.org/v1/taxa/autocomplete?q=snowy+owl&all_names=1

One more observation about the new all_names=1 support is that while I can retrieve a taxon by id# using the /v1/taxa/# endpoint, something my bot has always supported, I cannot pass all_names= on that request, and its results do not contain the names. I have no code that actually depends on this at this time, but it did seem inconsistent.

I found, however, that this works:

https://api.inaturalist.org/v1/taxa?taxon_id=28339&per_page=1&all_names=1

I used garter snakes here because I knew there were a lot of subspecies. This correctly returns 28339 as the ‘best match’ (whew, Elasticsearch does the right thing here - not sure it would in all cases, though, as in an entire subtree all with 0 observations).

It would be better if /v1/taxa/# would respond with the canonical list of all fields that all the other endpoints would’ve provided, or else supported the same flags to include/exclude additional fields that may not always be needed.

1 Like

As far as I’m aware, the website isn’t translated into Icelandic, so when the language (lexicon) of a common name is Icelandic, it isn’t assigned a locale automatically by the system.

3 Likes

OK, then ‘unk’ would be consistent for locale for the Icelandic result. Thanks for that explanation.

1 Like