Skip to content

Commit

Permalink
Reduce logging level for good lookups.
Browse files Browse the repository at this point in the history
  • Loading branch information
MattBlissett committed Sep 13, 2023
1 parent 1a9b4b2 commit b443d6c
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public Optional<LookupConcept> lookup(String value, LanguageRegion contextLang)
// matching by name
Concept nameMatch = namesCache.get(transformedValue);
if (nameMatch != null) {
log.info("value {} matched with concept {} by name", value, nameMatch.getName());
log.debug("value {} matched with concept {} by name", value, nameMatch.getName());
return Optional.of(toLookupConcept(nameMatch));
}

Expand All @@ -180,15 +180,15 @@ public Optional<LookupConcept> lookup(String value, LanguageRegion contextLang)
if (labelMatch != null) {
if (labelMatch.allMatches.size() == 1) {
Concept conceptMatched = labelMatch.allMatches.iterator().next();
log.info("value {} matched with concept {} by label", value, conceptMatched.getName());
log.debug("value {} matched with concept {} by label", value, conceptMatched.getName());
return Optional.of(toLookupConcept(conceptMatched));
}

// several candidates found. We try to match by using the language received as discriminator
// or English as fallback
Optional<Concept> langMatch = matchByLanguage(labelMatch, contextLang, value);
if (langMatch.isPresent()) {
log.info(
log.debug(
"value {} matched with concept {} by language {}",
value,
langMatch.get().getName(),
Expand All @@ -205,7 +205,7 @@ public Optional<LookupConcept> lookup(String value, LanguageRegion contextLang)
// if no match we try with the hidden labels
Concept hiddenMatch = hiddenLabelsCache.get(transformedValue);
if (hiddenMatch != null) {
log.info("value {} matched with concept {} by hidden label", value, hiddenMatch);
log.debug("value {} matched with concept {} by hidden label", value, hiddenMatch);
return Optional.of(toLookupConcept(hiddenMatch));
}
}
Expand All @@ -232,7 +232,7 @@ private Optional<Concept> matchByLanguage(LabelMatch match, LanguageRegion lang,

if (langMatches.size() == 1) {
Concept conceptMatched = langMatches.iterator().next();
log.info(
log.debug(
"Value {} matched with concept {} by using language {}", value, conceptMatched, lang);
return Optional.of(conceptMatched);
}
Expand Down Expand Up @@ -413,7 +413,7 @@ public InMemoryVocabularyLookup build() {
}

throw new IllegalArgumentException(
"Either the inputstream or the api url and the vocabulary name are required");
"Either the inputstream or the API URL and the vocabulary name are required");
}
}
}

0 comments on commit b443d6c

Please sign in to comment.