@@ -811,14 +811,16 @@ private NameUsageMatch fromDoc(Document doc) {
811
811
ancillaryStatus .setStatus (ancillaryDoc .get (FIELD_CATEGORY ));
812
812
//FIXME - this needs to removed from here - use a vocab
813
813
String formattedIUCN = IUCNUtils .formatIucn (ancillaryDoc .get (FIELD_CATEGORY ));
814
- IUCNUtils .IUCN iucn = IUCNUtils .IUCN .valueOf (formattedIUCN );
815
- ancillaryStatus .setStatus (formattedIUCN );
816
- ancillaryStatus .setStatusCode (iucn .getCode ());
817
- ancillaryStatus .setDatasetKey (dataset .getKey ().toString ());
818
- ancillaryStatus .setGbifKey (dataset .getGbifKey ());
819
- ancillaryStatus .setDatasetAlias (dataset .getAlias ());
820
- ancillaryStatus .setSourceId (ancillaryDoc .get (FIELD_ID ));
821
- u .addAdditionalStatus (ancillaryStatus );
814
+ if (formattedIUCN != null ) {
815
+ IUCNUtils .IUCN iucn = IUCNUtils .IUCN .valueOf (formattedIUCN );
816
+ ancillaryStatus .setStatus (formattedIUCN );
817
+ ancillaryStatus .setStatusCode (iucn .getCode ());
818
+ ancillaryStatus .setDatasetKey (dataset .getKey ().toString ());
819
+ ancillaryStatus .setGbifKey (dataset .getGbifKey ());
820
+ ancillaryStatus .setDatasetAlias (dataset .getAlias ());
821
+ ancillaryStatus .setSourceId (ancillaryDoc .get (FIELD_ID ));
822
+ u .addAdditionalStatus (ancillaryStatus );
823
+ }
822
824
}
823
825
} catch (IOException e ) {
824
826
log .error ("Cannot load usage {} from lucene index" , doc .get (FIELD_ID ), e );
@@ -952,6 +954,7 @@ public List<NameUsageMatch> matchByName(String name, boolean fuzzySearch, int ma
952
954
try {
953
955
return search (q , name , fuzzySearch , maxMatches );
954
956
} catch (RuntimeException e ) {
957
+ log .error ("Lucene search error" , e );
955
958
// for example TooComplexToDeterminizeException, see
956
959
// http://dev.gbif.org/issues/browse/POR-2725
957
960
log .warn ("Lucene failed to fuzzy search for name [{}]. Try a straight match instead" , name );
0 commit comments