Issue 18919

wrong faceted API results

18919
Reporter: sant
Type: Bug
Summary: wrong faceted API results
Priority: Unassessed
Status: Reopened
Created: 2017-02-05 18:55:08.383
Updated: 2017-10-06 13:41:34.598
        
Description: I found faceting issues when trying to request numerical data from our 4 published datasets.

We have an IPT, which serves 4 datasets from 1 institution.

So I would expect the follogin api calls to return the number of occurrences in each one of those 4 datasets.  But it only returns 2 of them:

http://api.gbif.org/v1/occurrence/search?facet=collectionCode&limit=0&publishingOrg=def87a70-0837-11d9-acb2-b8a03c50a862

http://api.gbif.org/v1/occurrence/search?facet=datasetKey&limit=0&publishingOrg=def87a70-0837-11d9-acb2-b8a03c50a862

If I use the term "institutionCode" instead of "publishgOrg", I got the expected results:

http://api.gbif.org/v1/occurrence/search?facet=datasetKey&datasetKey.facetLimit=5&datasetKey.facetOffset=0&limit=0&institutionCode=SANT

But I would prefer to use uuids for these faceting searches, because institution or collection codes are not necessarily unique.

Moreover, for whatever reason the codes worked in that scenario (requesting number of occurrences in each dataset) but do NOT work if I try to get the number of occurences of each ScientificName:

http://api.gbif.org/v1/occurrence/search?facet=ScientificName&limit=0&collectionCode=SANT-Lich&institutionCode=SANT

http://api.gbif.org/v1/occurrence/search?facet=ScientificName&limit=0&collectionCode=SANT-Algae&institutionCode=SANT

http://api.gbif.org/v1/occurrence/search?facet=ScientificName&limit=0&collectionCode=SANT-Bryo&institutionCode=SANT

http://api.gbif.org/v1/occurrence/search?facet=ScientificName&limit=0&collectionCode=SANT&institutionCode=SANT
For whatever reason, the first 2 request work but the last 2 requests do not return results.
Again, the 2 problematic datasets are those called "SANT" and "SANT-Bryo", which were not returned in the first urls (requesting faceted occurrence counts of our 4 datasets, using publishingOrg uuid as a parameter).
]]>
    


Author: cgendreau
Comment: An issue with publishgOrg was fixed by this commit: https://github.com/gbif/occurrence/commit/90648b90328c0b7126f786a698040359f5e413ef
Created: 2017-02-05 21:14:01.341
Updated: 2017-02-05 21:14:01.341


Author: sant
Created: 2017-02-06 01:27:07.924
Updated: 2017-02-06 01:37:25.425
        
Thanks Christian.

I must be misunderstanding your comment.
If the issue is fixed, why do I get wrong results?

By the way, another wrong faceting example.
This request returns 2 results, but no ScientificName facets are shown.

http://api.gbif.org/v1/occurrence/search?facet=ScientificName&limit=10&institutionCode=SANT&TypeStatus=HOLOTYPE

If I remove the institutionCode filter, then I get both results and facets.
Why does this happen??


    


Author: hoefft
Comment: From the examples i tried this seemed to be fixed. Can you confirm [~sant] ?
Created: 2017-10-06 13:41:34.598
Updated: 2017-10-06 13:41:34.598