public ParsedQuery parse(final String query) throws ParseException {
        final TokenCollectingQueryParser parser = new TokenCollectingQueryParser(ParsedTerm.DEFAULT_FIELD, ANALYZER);
        parser.setSplitOnWhitespace(true);
        parser.setAllowLeadingWildcard(allowLeadingWildcard);

        final Query parsed = parser.parse(query);
        final ParsedQuery.Builder builder = ParsedQuery.builder().query(query);

        builder.tokensBuilder().addAll(parser.getTokens());

        final TermCollectingQueryVisitor visitor = new TermCollectingQueryVisitor(ANALYZER, parser.getTokenLookup());
        parsed.visit(visitor);
        builder.termsBuilder().addAll(visitor.getParsedTerms());
        return builder.build();
    }
@Test
    void testDateRange() throws ParseException {
        Assertions.assertThat(parser.parse("otherDate:[now-3d TO now-4d]").terms())
                .hasSize(2)
                .extracting(ParsedTerm::value)
                .contains("now-3d", "now-4d");

        Assertions.assertThat(parser.parse("otherDate:[20020101 TO 20030101]").terms())
                .hasSize(2)
                .extracting(ParsedTerm::value)
                .contains("20020101", "20030101");

        Assertions.assertThat(parser.parse("otherDate:[now-5d TO now-4d]").terms())
                .extracting(ParsedTerm::value)
                .contains("now-5d", "now-4d");

        Assertions.assertThat(parser.parse("otherDate:[now TO now+60d]").terms())
                .extracting(ParsedTerm::value)
                .contains("now", "now+60d");

    }