Merge branch 'RED-10644-4.3' into 'release/4.423.x'

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

See merge request redactmanager/redaction-service!575
This commit is contained in:
Dominique Eifländer 2024-12-10 09:20:13 +01:00
commit 751eb63394

View File

@ -1002,11 +1002,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