<div dir="ltr">Thanks a lot Federico & Markus.<div><br></div><div>I am just looking for a quick and easy summary of the names of specimens stored in our collections.</div><div><br></div><div>Faceting on their keys might be easy, but does not help in terms of speed. We would still need to launch thousands of api requests (one per key) to achieve what I was trying to find out in just one http request.<br></div><div><br></div><div>So I prefer to wait until faceting ScientificNames (and collection/instution codes/uuids) works as expected.</div><div><br></div><div>Is there any risk if we publish any updates on our IPT while you are fixing wrong indexing of our datasets?  </div><div><br></div><div><br></div><div><div>On the other hand, as you mentioned keys, I wonder if faceting is always limited to facet-count pairs. Perhaps there might be triads in some particular cases?</div><div><br></div><div>I would find it helpful if faceting ScientificNames could return the faceted names, their counts, PLUS their keys (instead of just names & counts).<br></div><div>That would facilitate further connections to other api requests which are based on keys.<br></div></div><div><br></div><div>Thanks a lot for your help</div><div><br></div><div>David</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 14 February 2017 at 11:23, Federico Mendez <span dir="ltr"><<a href="mailto:fmendez@gbif.org" target="_blank">fmendez@gbif.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:calibri,sans-serif">
<div>David,</div><span class="gmail-">
<div><br>
</div>
<div><b>(1) RESULTS COUNT NOT MATCHING SUM OF ALL FACET COUNTS</b></div>
<div><br>
</div>
</span><div>It seems that something went wrong indexing some SANT datasets, next week we’ll rebuild our search index and hopefully some of those issues will disappear. By the moment I’d suggest to  facet on species_key which seems to give the correct number of records:</div>
<div><a href="http://api.gbif.org/v1/occurrence/search?facet=species_key&limit=10&collectionCode=SANT-Lich&genusKey=2581943" target="_blank">http://api.gbif.org/v1/<wbr>occurrence/search?facet=<wbr>species_key&limit=10&<wbr>collectionCode=SANT-Lich&<wbr>genusKey=2581943</a> </div><span class="gmail-">
<div><br>
</div>
<div><b>(2) LOWERCASE FACETS (facets values not matching results values):</b></div>
<div><b><br>
</b></div>
</span><div>This was an implementation decision to deal with cases which values were reported using different casing standards, which mostly applies for fields like locality and authors but not really for scientific name, collection code, record number, etc. We’ll
 test a new version of the search index that preserve the original values and we’ll report the results back to you.</div><span class="gmail-">
<div><br>
</div>
<div><br>
</div>
<div><b>(3) FACETING COLLECTIONCODE VALUES of a single institution fails depending on filtering parameter used to match the institution (code or uuid):</b></div>
<div><b><br>
</b></div>
</span><div>It looks to me that just like in (1) something went wrong indexing some datasets, as you can see in the following queries you get a difference in amount of datasets published by ’SANT’ vs its correspondent organisation UUID:</div>
<div><a href="http://api.gbif.org/v1/occurrence/search?facet=collectionCode&limit=0&publishingOrg=def87a70-0837-11d9-acb2-b8a03c50a862&facet=dataset_key" target="_blank">http://api.gbif.org/v1/<wbr>occurrence/search?facet=<wbr>collectionCode&limit=0&<wbr>publishingOrg=def87a70-0837-<wbr>11d9-acb2-b8a03c50a862&facet=<wbr>dataset_key</a> —>
 2</div>
<div><a href="http://api.gbif.org/v1/occurrence/search?facet=collectionCode&limit=0&institutionCode=SANT&facet=dataset_key" target="_blank">http://api.gbif.org/v1/<wbr>occurrence/search?facet=<wbr>collectionCode&limit=0&<wbr>institutionCode=SANT&facet=<wbr>dataset_key</a> —> 4</div><span class="gmail-">
<div><br>
</div>
<div><b>(4) FACETING SCIENTIFICNAME FAILS FOR SOME DATASETS, but works as expected for others: </b></div>
<div><b><br>
</b></div>
</span><div>I’d recommend that, by now, you should try to facet on species_key, we’ll test all these inconsistencies later next week, we are in the processing of building a new GBIF Backbone (<a href="http://www.gbif.org/dataset/d7dddbf4-2cf0-4f39-9b2a-bb099caae36c" target="_blank">http://www.gbif.org/dataset/<wbr>d7dddbf4-2cf0-4f39-9b2a-<wbr>bb099caae36c</a>)
 and that will require to reprocess all the occurrence records, while doing that we try to fix some the issues reported here.</div>
<div><br>
</div>
<div>Thanks, Federico Mendez.</div>
<div><b><br>
</b></div>
<span id="gmail-m_4265165902179256648OLK_SRC_BODY_SECTION">
<div style="font-family:calibri;font-size:11pt;text-align:left;color:black;border-width:1pt medium medium;border-style:solid none none;border-bottom-color:initial;border-left-color:initial;padding:3pt 0in 0in;border-top-color:rgb(181,196,223);border-right-color:initial">
<span style="font-weight:bold">From: </span>API-users <<a href="mailto:api-users-bounces@lists.gbif.org" target="_blank">api-users-bounces@lists.gbif.<wbr>org</a>> on behalf of Herbario SANT <<a href="mailto:sant.herbarium@gmail.com" target="_blank">sant.herbarium@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Friday 10 February 2017 at 22:24<br>
<span style="font-weight:bold">To: </span>"<a href="mailto:api-users@lists.gbif.org" target="_blank">api-users@lists.gbif.org</a>" <<a href="mailto:api-users@lists.gbif.org" target="_blank">api-users@lists.gbif.org</a>><br>
<span style="font-weight:bold">Cc: </span>helpdesk <<a href="mailto:helpdesk@gbif.org" target="_blank">helpdesk@gbif.org</a>><br>
<span style="font-weight:bold">Subject: </span>[API-users] wrong faceted API results/counts (at least in our datasets) and lowercased facet values (everywhere)<br>
</div><div><div class="gmail-h5">
<div><br>
</div>
<div>
<div>
<div dir="ltr">Hello.<br>
<br>
I am trying to play with faceted results from the occurrence api, but returned values are very odd IMHO.  
<div><br>
Perhaps I am misunderstanding how faceting should work? Or there might be some problem with the indexing of these particular datasets.   </div>
<div>I am pretty lost.  This is what I found:</div>
<div><br>
<br>
<b>(1) RESULTS COUNT NOT MATCHING SUM OF ALL FACET COUNTS</b><br>
<br>
I put a simple example so everything is returned in one page.<br>
<br>
<a href="http://api.gbif.org/v1/occurrence/search?facet=ScientificName&limit=10&collectionCode=SANT-Lich&genusKey=2581943" target="_blank">http://api.gbif.org/v1/<wbr>occurrence/search?facet=<wbr>ScientificName&limit=10&<wbr>collectionCode=SANT-Lich&<wbr>genusKey=2581943</a><br>
<br>
The count value is 4, the number of results is 4.<br>
But the number of facets is 1, and its count is 2. <br>
<br>
The faceted term ScientificName is a mandatory field, so no null values should happen. I would expect every occurrence having a value for it.<br>
And the number of values is short, so everything is returned in one request (no paging needed).
<br>
So, in such a case shouldn't the sum of facet counts be equal to the number of results?<br>
Why the count of the faceted name is not 4?<br>
<br>
<br>
<b>(2) LOWERCASE FACETS (facets values not matching results values):<br>
</b><br>
<div>Look at the same api request above (plant names)<br>
 <br>
results: <br>
Scientificname: "Generic_name specific_name (Basionym_Authors) Name_Authors"<br>
<br>
facets: <br>
name: "generic_name specific_name (basionym_<wbr>authors) name_authors"</div>
<div><br>
Why are the facets names always in lowercase? <br>
I would say that is an error which shouldn't happen.<br>
<br>
But I reported it some days ago and got no answer, so I wonder if this is the intended api behaviour.<br>
<br>
<a href="http://dev.gbif.org/issues/browse/PF-2758" target="_blank">http://dev.gbif.org/issues/<wbr>browse/PF-2758</a><br>
<br>
Not only scientific names are lowercased. This also happens to collectionCode in the next question.<br>
<br>
<br>
<b>(3) FACETING COLLECTIONCODE VALUES of a single institution fails depending on filtering parameter used to match the institution (code or uuid):</b><br>
<br>
Our institution (uuid= def87a70-0837-11d9-acb2-<wbr>b8a03c50a862 , institutionCode=SANT) serves datasets from 4 collections, which should sum up more than 100000 records.
<br>
<br>
Why do I get only 2 of our 4 datasets faceted in the following request, which uses our publishingOrg uuid? (uuid should be the preferred option to do this, as code might not be unique for our institution)<br>
<br>
<a href="http://api.gbif.org/v1/occurrence/search?facet=collectionCode&limit=0&publishingOrg=def87a70-0837-11d9-acb2-b8a03c50a862" target="_blank">http://api.gbif.org/v1/<wbr>occurrence/search?facet=<wbr>collectionCode&limit=0&<wbr>publishingOrg=def87a70-0837-<wbr>11d9-acb2-b8a03c50a862</a><br>
<br>
Why do I got 4 of 4 if I filter the request using institutionCode instead? (fortunately, nobody else uses the same institutionCode yet, so numbers are correct)<br>
<br>
<a href="http://api.gbif.org/v1/occurrence/search?facet=collectionCode&limit=0&institutionCode=SANT" target="_blank">http://api.gbif.org/v1/<wbr>occurrence/search?facet=<wbr>collectionCode&limit=0&<wbr>institutionCode=SANT</a><br>
<br>
And why do counts differ for the same facet value (sant-lich) in those two requests?<br>
(9960 in the 1st request, 10007 in the 2nd one)<br>
<br>
Why are facet values lowercase again? ("sant-lich" instead of "SANT-Lich")<br>
<br>
<br>
<b>(4) FACETING SCIENTIFICNAME FAILS FOR SOME DATASETS, but works as expected for others:
</b><br>
<br>
More than 1000 faceted Scientificnames returned for our SANT-Lich and SANT-Algae collections. Both of them look correct results:<br>
<br>
<a href="http://api.gbif.org/v1/occurrence/search?facet=ScientificName&limit=0&collectionCode=SANT-Lich&ScientificName.facetLimit=50000&ScientificName.facetOffset=0" target="_blank">http://api.gbif.org/v1/<wbr>occurrence/search?facet=<wbr>ScientificName&limit=0&<wbr>collectionCode=SANT-Lich&<wbr>ScientificName.facetLimit=<wbr>50000&ScientificName.<wbr>facetOffset=0</a><br>
<br>
<a href="http://api.gbif.org/v1/occurrence/search?facet=ScientificName&limit=0&collectionCode=SANT-Algae&ScientificName.facetLimit=50000&ScientificName.facetOffset=0" target="_blank">http://api.gbif.org/v1/<wbr>occurrence/search?facet=<wbr>ScientificName&limit=0&<wbr>collectionCode=SANT-Algae&<wbr>ScientificName.facetLimit=<wbr>50000&ScientificName.<wbr>facetOffset=0</a><br>
<br>
But no facets returned for SANT-Bryo (which contains several hundred distinct scientificname values):</div>
<div><br>
<a href="http://api.gbif.org/v1/occurrence/search?facet=ScientificName&limit=0&collectionCode=SANT-Bryo&ScientificName.facetLimit=50000&ScientificName.facetOffset=0" target="_blank">http://api.gbif.org/v1/<wbr>occurrence/search?facet=<wbr>ScientificName&limit=0&<wbr>collectionCode=SANT-Bryo&<wbr>ScientificName.facetLimit=<wbr>50000&ScientificName.<wbr>facetOffset=0</a><br>
<br>
And only 7 facets for SANT scientificnames (should be over 10 thousand, as this is by far our largest dataset):</div>
<div><br>
<a href="http://api.gbif.org/v1/occurrence/search?facet=ScientificName&limit=0&collectionCode=SANT&ScientificName.facetLimit=50000&ScientificName.facetOffset=0" target="_blank">http://api.gbif.org/v1/<wbr>occurrence/search?facet=<wbr>ScientificName&limit=0&<wbr>collectionCode=SANT&<wbr>ScientificName.facetLimit=<wbr>50000&ScientificName.<wbr>facetOffset=0</a><br>
<br>
<br>
<br>
Other than the lowercase facets issue (2), I couldn't reproduce issues 1,3,4 in other institutions datasets. </div>
<div>So I wonder if all this is somehow related to a wrong indexing of our IPT.<br>
<br>
Has anyone else detected these problems?<br>
<br>
Thanks a lot in advance for your help</div>
<div><br>
</div>
<div>David</div>
<div><br>
</div>
<div>-- <br>
</div>
<div>David García San León<br>
Herbario SANT<br>
Universidade de Santiago de Compostela<br>
<br>
</div>
</div>
</div>
</div>
</div>
</div></div></span>
</div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div>David García San León</div><div>Herbario SANT<br></div><div>Universidade de Santiago de Compostela<br></div><div><br></div></div>
</div></div>