Pull request #481: RED-5275: Fixed not all headline were found because headline contains newlines

Merge in RED/redaction-service from RED-5275 to master

* commit '074205aa4d4532d5143463ab80199be08e1599a1':
  RED-5275: Fixed not all headline were found because headline contains newlines
This commit is contained in:
Dominique Eiflaender 2022-09-28 15:16:08 +02:00
commit 97209a3508

View File

@ -942,12 +942,18 @@ public class Section {
@Argument(ArgumentType.STRING) String reason,
@Argument(ArgumentType.LEGAL_BASIS) String legalBasis) {
if (!headline.isBlank() && searchText.contains(headline)) {
Set<Entity> found = findEntities(headline.trim(), type, false, true, ruleNumber, reason, legalBasis, Engine.RULE, false);
if (!headline.isBlank()) {
String cleanHeadline = headline.replaceAll("\\n", " ").replaceAll(" ", " ").trim();
if(searchText.contains(cleanHeadline)) {
Set<Entity> found = findEntities(cleanHeadline, type, false, true, ruleNumber, reason, legalBasis, Engine.RULE, false);
EntitySearchUtils.addEntitiesWithHigherRank(entities, found, dictionary);
}
}
}
@ThenAction