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 testValueTokenAnalyzed() throws ParseException {
        // we are using standard analyzer in the parser, which means that values are processed by the lowercase filter
        // This can lead to mismatches in equals during the value token recognition. This tests ensures that
        // uppercase values are correctly recognized and assigned
        final ParsedQuery query = parser.parse("foo:BAR");

        assertThat(query.terms())
                .extracting(ParsedTerm::valueToken)
                .hasOnlyOneElementSatisfying(token -> assertThat(token).map(ImmutableToken::image).hasValue("BAR"));
    }