Prefix matches on "snow" better match than the AOU code SNOW for Snowy Owl?

As described in https://forum.inaturalist.org/t/handling-matches-on-name-fields-not-returned-in-api-v1-taxa-response/6935/14 , we cannot guarantee that the matched_term will be the term you’re expecting. We just know that it will be a match, and that it will be the “best” match according to Elasticsearch (see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#_how_to_find_the_best_fragments for more information). In this case Elasticsearch thinks “Snowy owl” is the best match and so that’s what we return. I could speculate why it thinks that’s the best term, but perhaps the issue is best taken up with Elastic.

It is not a feature of taxa searches that exact matches on AOU codes will return those results first, so I wouldn’t give your users that expectation. All searches use the same weighted scoring/sorting of results.

I don’t consider this a bug because we don’t set expectations that matched_term is the closest one to your search term (note we don’t call it best match which is a term you used). But at the same time we do request the best matched term, and that is what we’re returning.