Skip to content

Commit

Permalink
IUCN
Browse files Browse the repository at this point in the history
  • Loading branch information
djtfmartin committed Sep 9, 2024
1 parent 07ca4a5 commit 39623d1
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -811,14 +811,16 @@ private NameUsageMatch fromDoc(Document doc) {
ancillaryStatus.setStatus(ancillaryDoc.get(FIELD_CATEGORY));
//FIXME - this needs to removed from here - use a vocab
String formattedIUCN = IUCNUtils.formatIucn(ancillaryDoc.get(FIELD_CATEGORY));
IUCNUtils.IUCN iucn = IUCNUtils.IUCN.valueOf(formattedIUCN);
ancillaryStatus.setStatus(formattedIUCN);
ancillaryStatus.setStatusCode(iucn.getCode());
ancillaryStatus.setDatasetKey(dataset.getKey().toString());
ancillaryStatus.setGbifKey(dataset.getGbifKey());
ancillaryStatus.setDatasetAlias(dataset.getAlias());
ancillaryStatus.setSourceId(ancillaryDoc.get(FIELD_ID));
u.addAdditionalStatus(ancillaryStatus);
if (formattedIUCN != null) {
IUCNUtils.IUCN iucn = IUCNUtils.IUCN.valueOf(formattedIUCN);
ancillaryStatus.setStatus(formattedIUCN);
ancillaryStatus.setStatusCode(iucn.getCode());
ancillaryStatus.setDatasetKey(dataset.getKey().toString());
ancillaryStatus.setGbifKey(dataset.getGbifKey());
ancillaryStatus.setDatasetAlias(dataset.getAlias());
ancillaryStatus.setSourceId(ancillaryDoc.get(FIELD_ID));
u.addAdditionalStatus(ancillaryStatus);
}
}
} catch (IOException e) {
log.error("Cannot load usage {} from lucene index", doc.get(FIELD_ID), e);
Expand Down Expand Up @@ -952,6 +954,7 @@ public List<NameUsageMatch> matchByName(String name, boolean fuzzySearch, int ma
try {
return search(q, name, fuzzySearch, maxMatches);
} catch (RuntimeException e) {
log.error("Lucene search error", e);
// for example TooComplexToDeterminizeException, see
// http://dev.gbif.org/issues/browse/POR-2725
log.warn("Lucene failed to fuzzy search for name [{}]. Try a straight match instead", name);
Expand Down

0 comments on commit 39623d1

Please sign in to comment.