diff --git a/inception/inception-search-mtas/src/main/java/de/tudarmstadt/ukp/inception/search/index/mtas/MtasDocumentIndex.java b/inception/inception-search-mtas/src/main/java/de/tudarmstadt/ukp/inception/search/index/mtas/MtasDocumentIndex.java index e4bf24e1d71..a9e96072b89 100644 --- a/inception/inception-search-mtas/src/main/java/de/tudarmstadt/ukp/inception/search/index/mtas/MtasDocumentIndex.java +++ b/inception/inception-search-mtas/src/main/java/de/tudarmstadt/ukp/inception/search/index/mtas/MtasDocumentIndex.java @@ -1071,11 +1071,12 @@ else if (annotationDocumentId != -1 .filter(t -> t.getPositionStart() >= matchStart && t.getPositionEnd() < matchEnd) .mapToInt(MtasTokenString::getOffsetStart).min() - .getAsInt()); + .orElse(matchStart)); result.setOffsetEnd(tokens.stream() .filter(t -> t.getPositionStart() >= matchStart && t.getPositionEnd() < matchEnd) - .mapToInt(MtasTokenString::getOffsetEnd).max().getAsInt()); + .mapToInt(MtasTokenString::getOffsetEnd).max() + .orElse(matchEnd)); result.setTokenStart(matchStart); result.setTokenLength(matchEnd - matchStart); result.setReadOnly(annotationDocument != null