public SearchExpressionQuery buildQuery(final ExpressionOperator expression) {
        Set<String> terms = Collections.emptySet();
        Query query = null;
        if (expression != null) {
            // Build a query.
            terms = new HashSet<>();
            query = getQuery(expression, terms);
        }

        if (query == null) {
            query = new MatchAllDocsQuery();
        } else if (query instanceof final BooleanQuery booleanQuery) {
            final boolean hasInclusiveClauses = hasInclusiveClauses(query);
            if (!hasInclusiveClauses) {
                final Builder builder = new Builder();
                builder.add(new MatchAllDocsQuery(), Occur.MUST);
                for (final BooleanClause booleanClause : booleanQuery.clauses()) {
                    builder.add(booleanClause);
                }
                query = builder.build();
            }
        }
        return new SearchExpressionQuery(query, terms);
    }
Convert our query objects to a LUCENE query.
stroom-index/stroom-index-lucene980/src/main/java/stroom/index/lucene980/SearchExpressionQueryBuilder.java