Pull request #338: RED-3327: Ignore recommendations if touches other type

Merge in RED/redaction-service from RED-3327 to release/3.54.x

* commit '07ffd900582ada731a7381d825509ed5e656b70e':
  RED-3327: Ignore recommendations if touches other type
This commit is contained in:
Dominique Eiflaender 2022-02-01 09:59:39 +01:00
commit 681f19507f

View File

@ -128,10 +128,15 @@ public class EntitySearchUtils {
for (Entity inner : entities) {
if (inner.getWord().length() < word.getWord()
.length() && inner.getStart() >= word.getStart() && inner.getEnd() <= word.getEnd() && word != inner && word.getSectionNumber() == inner.getSectionNumber()) {
// FIXME this is workaround for RED-3327 and should be removed in the future.
if(word.getType().contains("recommendation_") && !inner.getType().contains("recommendation_")) {
wordsToRemove.add(word);
} else {
wordsToRemove.add(inner);
}
}
}
}
entities.removeAll(wordsToRemove);
}