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

This commit is contained in:
Dominique Eifländer 2024-12-09 15:09:21 +01:00
parent 5ef3699648
commit 4f36677933

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