Skip to content

Commit cb8553f

Browse files
committed
Include atomised name to avoid pipelines and other services reparsing the name
#1350
1 parent 1c7452b commit cb8553f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

matching-ws/src/main/java/life/catalogue/matching/service/IndexingService.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -863,22 +863,18 @@ protected static Document toDoc(NameUsage nameUsage) {
863863

864864
Optional<String> optCanonical = Optional.empty();
865865
ParsedName pn = null;
866-
866+
NomCode nomCode = null;
867867
try {
868-
NomCode nomCode = null;
869868
if (!StringUtils.isEmpty(nameUsage.getNomenclaturalCode())) {
870869
nomCode = NomCode.valueOf(nameUsage.getNomenclaturalCode());
871870
}
872-
ParsedName pn = NameParsers.INSTANCE.parse(nameUsage.getScientificName(), rank, nomCode);
871+
pn = NameParsers.INSTANCE.parse(nameUsage.getScientificName(), rank, nomCode);
873872
// canonicalMinimal will construct the name without the hybrid marker and authorship
874873
String canonical = NameFormatter.canonicalMinimal(pn);
875874
optCanonical = Optional.ofNullable(canonical);
876875
} catch (UnparsableNameException | InterruptedException e) {
877876
// do nothing
878877
log.debug("Unable to parse name to create canonical: {}", nameUsage.getScientificName());
879-
} catch ( JsonProcessingException e) {
880-
// do nothing
881-
log.debug("Unable to parse name to create canonical: {}", nameUsage.getScientificName());
882878
}
883879

884880
if (pn != null){

0 commit comments

Comments
 (0)