code: @Override
     public Query rewrite(IndexReader reader) throws IOException
     {
        Query cQuery = contextQuery.rewrite(reader);
        Query sQuery = subQuery.rewrite(reader);
        if (contextQuery instanceof DescendantSelfAxisQuery)
        {
           DescendantSelfAxisQuery dsaq = (DescendantSelfAxisQuery)contextQuery;
           if (dsaq.subQueryMatchesAll())
           {
              return new DescendantSelfAxisQuery(dsaq.getContextQuery(), sQuery, dsaq.getMinLevels() + getMinLevels(),
                 indexConfig).rewrite(reader);
           }
        }
        if (cQuery == contextQuery && sQuery == subQuery) // NOSONAR
        {
           return this;
        }
        else
        {
           return new DescendantSelfAxisQuery(cQuery, sQuery, minLevels, indexConfig);
        }
     }
docs: {@inheritDoc}