<commit_before>package org.compass.core.impl;

import org.compass.core.CompassQuery;
import org.compass.core.CompassQueryFilter;
import org.compass.core.CompassQueryFilterBuilder;
import org.compass.core.engine.SearchEngineQueryFilterBuilder;
import org.compass.core.mapping.ResourcePropertyLookup;
import org.compass.core.spi.InternalCompass;

/**
 * @author kimchy
 */
public class DefaultCompassQueryFilterBuilder implements CompassQueryFilterBuilder {

    public static class DefaultCompassBooleanQueryFilterBuilder implements CompassBooleanQueryFilterBuilder {

        private SearchEngineQueryFilterBuilder.SearchEngineBooleanQueryFilterBuilder filterBuilder;

        public DefaultCompassBooleanQueryFilterBuilder(SearchEngineQueryFilterBuilder.SearchEngineBooleanQueryFilterBuilder filterBuilder) {
            this.filterBuilder = filterBuilder;
        }

        public CompassBooleanQueryFilterBuilder and(CompassQueryFilter filter) {
            filterBuilder.and(((DefaultCompassQueryFilter) filter).getFilter());
            return this;
        }

        public CompassBooleanQueryFilterBuilder or(CompassQueryFilter filter) {
            filterBuilder.or(((DefaultCompassQueryFilter) filter).getFilter());
            return this;
        }

        public CompassBooleanQueryFilterBuilder andNot(CompassQueryFilter filter) {
            filterBuilder.andNot(((DefaultCompassQueryFilter) filter).getFilter());
            return this;
        }

        public CompassBooleanQueryFilterBuilder xor(CompassQueryFilter filter) {
            filterBuilder.xor(((DefaultCompassQueryFilter) filter).getFilter());
            return this;
        }

        public CompassQueryFilter toFilter() {
            return new DefaultCompassQueryFilter(filterBuilder.toFilter());
        }
    }

    private InternalCompass compass;

    private SearchEngineQueryFilterBuilder filterBuilder;

    private boolean convertOnlyWithDotPath = false;


    public DefaultCompassQueryFilterBuilder(SearchEngineQueryFilterBuilder filterBuilder, InternalCompass compass) {
        this.filterBuilder = filterBuilder;
        this.compass = compass;
    }

    public CompassQueryFilterBuilder convertOnlyWithDotPath(boolean convertOnlyWithDotPath) {
        this.convertOnlyWithDotPath = convertOnlyWithDotPath;<commit_msg>CMP-816 Allow construction of CompassQueryBuilder without needing a CompassSession<commit_after>package org.compass.core.impl;

import org.compass.core.CompassQuery;
import org.compass.core.CompassQueryFilter;
import org.compass.core.CompassQueryFilterBuilder;
import org.compass.core.engine.SearchEngineQueryFilterBuilder;
import org.compass.core.mapping.ResourcePropertyLookup;
import org.compass.core.spi.InternalCompass;

/**
 * @author kimchy
 */
public class DefaultCompassQueryFilterBuilder implements CompassQueryFilterBuilder {

    public static class DefaultCompassBooleanQueryFilterBuilder implements CompassBooleanQueryFilterBuilder {

        private SearchEngineQueryFilterBuilder.SearchEngineBooleanQueryFilterBuilder filterBuilder;

        public DefaultCompassBooleanQueryFilterBuilder(SearchEngineQueryFilterBuilder.SearchEngineBooleanQueryFilterBuilder filterBuilder) {
            this.filterBuilder = filterBuilder;
        }

        public CompassBooleanQueryFilterBuilder and(CompassQueryFilter filter) {
            filterBuilder.and(((DefaultCompassQueryFilter) filter).getFilter());
            return this;
        }

        public CompassBooleanQueryFilterBuilder or(CompassQueryFilter filter) {
            filterBuilder.or(((DefaultCompassQueryFilter) filter).getFilter());
            return this;
        }

        public CompassBooleanQueryFilterBuilder andNot(CompassQueryFilter filter) {
            filterBuilder.andNot(((DefaultCompassQueryFilter) filter).getFilter());
            return this;
        }

        public CompassBooleanQueryFilterBuilder xor(CompassQueryFilter filter) {
            filterBuilder.xor(((DefaultCompassQueryFilter) filter).getFilter());
            return this;
        }

        public CompassQueryFilter toFilter() {
            return new DefaultCompassQueryFilter(filterBuilder.toFilter());
        }
    }

    private final InternalCompass compass;

    private final SearchEngineQueryFilterBuilder filterBuilder;

    private boolean convertOnlyWithDotPath = false;


    public DefaultCompassQueryFilterBuilder(SearchEngineQueryFilterBuilder filterBuilder, InternalCompass compass) {
        this.filterBuilder = filterBuilder;
        this.compass = compass;
    }

    public CompassQueryFilterBuilder convertOnlyWithDotPath(boolean convertOnlyWithDotPath) {
        this.convertOnlyWithDotPath = convertOnlyWithDotPath;
{'fraction_non_alphanumeric': 0.06325364924899514, 'fraction_numerical': 0.0006346519991537973, 'mean_word_length': 4.051282051282051, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5904899', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1083, 'n_words': 205}