code: @Override
    public MtasSpanQuery rewrite(IndexReader reader) throws IOException {
      MtasSpanQuery newClause = clause.rewrite(reader);
      if (!newClause.equals(clause)) {
        return new MtasSpanEndQuery(newClause).rewrite(reader);
      } else if (newClause.getMaximumWidth() != null
          && newClause.getMaximumWidth() == 0) {
        return newClause;
      } else {
        return super.rewrite(reader);
      }
    }
docs: /*
  (non-Javadoc)
  
  @see
  org.apache.lucene.search.Query#rewrite(org.apache.lucene.index.IndexReader)