class CustomQueryParser extends QueryParser {

    /**
     * Create a query parser customized for OpenGrok.
     *
     * @param field default field for unqualified query terms
     */
    public CustomQueryParser(String field) {
        super(field, new CompatibleAnalyser());
        setDefaultOperator(AND_OPERATOR);
        setAllowLeadingWildcard(
                RuntimeEnvironment.getInstance().isAllowLeadingWildcard());
        // Convert terms to lower case manually to prevent changing the case
        // if the field is case sensitive.
        // since lucene 7.0.0 below is in place so every class that
        // extends Analyser must normalize the text by itself
        /*
## AnalyzingQueryParser removed (LUCENE-7355)

The functionality of AnalyzingQueryParser has been folded into the classic
QueryParser, which now passes terms through Analyzer#normalize when generating
queries.

## CommonQueryParserConfiguration.setLowerCaseExpandedTerms removed (LUCENE-7355)

Expanded terms are now normalized through
Analyzer#normalize.
        */

    }

    /**
     * Is this field case sensitive?
     *
     * @param field name of the field to check
     * @return {@code true} if the field is case sensitive, {@code false}
     * otherwise
     */
    protected static boolean isCaseSensitive(String field) {<FILL_FUNCTION_BODY>}

    /**
     * Get a canonical form of a search term. This will convert the term to
     * lower case if the field is case insensitive.
     *
     * @param field the field to search on
     * @param term the term to search for
     * @return the canonical form of the search term, which matches how it is
     * stored in the index
     */
    // The analyzers use the default locale. They probably should have used
    // a fixed locale, but since they don't, we ignore that PMD warning here.
    @SuppressWarnings("PMD.UseLocaleWithCaseConversions")
    private static String getCanonicalTerm(String field, String term) {
        return isCaseSensitive(field) ? term : term.toLowerCase(Locale.ROOT);
    }

    // Override the get***Query() methods to lower case the search terms if
    // the field is case sensitive. We don't need to override getFieldQuery()
    // because it uses the analyzer to convert the terms to canonical form.
    @Override
    protected Query getFuzzyQuery(String field, String term, float min)
            throws ParseException {
        return super.getFuzzyQuery(field, getCanonicalTerm(field, term), min);
    }

    @Override
    protected Query getPrefixQuery(String field, String term)
            throws ParseException {
        return super.getPrefixQuery(field, getCanonicalTerm(field, term));
    }

    @Override
    protected Query getRangeQuery(String field, String term1, String term2,
            boolean startinclusive, boolean endinclusive)
            throws ParseException {
        return super.getRangeQuery(
                field,
                getCanonicalTerm(field, term1),
                getCanonicalTerm(field, term2),
                startinclusive,
                endinclusive);
    }

    @Override
    protected Query getWildcardQuery(String field, String term)
            throws ParseException {
        return super.getWildcardQuery(field, getCanonicalTerm(field, term));
    }
}

        // Only definition search and reference search are case sensitive
        return QueryBuilder.DEFS.equals(field)
                || QueryBuilder.REFS.equals(field);
    
<no_super_class>