code: protected int correctEndOffsetForCloseElement(int endOffset) {
      if (docText.charAt(endOffset-1) == '>') {
        final int newEndOffset = docText.lastIndexOf('<', endOffset - 2);
        if (newEndOffset > offsetPair[0])//just to be sure
          return newEndOffset;
      }
      return endOffset;
    }
docs: Correct endOffset for adjacent element at the right side.  E.g. offsetPair might point to:
  <pre>
  foo&lt;/tag&gt;
  </pre>
  and this method pulls the end offset left to the '&lt;'. This is necessary for use with
  {@link org.apache.lucene.analysis.charfilter.HTMLStripCharFilter}.
  
  See https://issues.apache.org/jira/browse/LUCENE-5734