Merge branch 'RED-10644-4.2' into 'release/4.348.x'

RED-10644: Fixed dublicated entries with whitespace at the end

See merge request redactmanager/redaction-service!574
This commit is contained in:
Dominique Eifländer 2024-12-10 09:20:28 +01:00
commit 29cab89def

View File

@ -1000,11 +1000,11 @@ public class EntityCreationService {
return Optional.empty(); // Entity has been recategorized and should not be created at all.
}
TextEntity existingEntity = optionalTextEntity.get();
if (existingEntity.getTextRange().equals(textRange)) {
if (existingEntity.getTextRange().equals(trimmedTextRange)) {
return optionalTextEntity; // exactly the same entity, return directly
}
if (!existingEntity.resized()) {
addDuplicateEntityToGraph(existingEntity, textRange, node);
addDuplicateEntityToGraph(existingEntity, trimmedTextRange, node);
return optionalTextEntity; // If Entity has not been resized, insert as duplicate at appropriate position
}
return Optional.empty(); // Entity has been resized, if there are duplicates they should be treated there