Search in sources :

Example 36 with BoolQueryBuilder

use of org.opensearch.index.query.BoolQueryBuilder in project fess by codelibs.

the class EsAbstractConditionQuery method regBoolCQ.

protected BoolQueryBuilder regBoolCQ(List<QueryBuilder> mustList, List<QueryBuilder> shouldList, List<QueryBuilder> mustNotList, List<QueryBuilder> filterList) {
    assertObjectNotNull("mustList", mustList);
    assertObjectNotNull("shouldList", shouldList);
    assertObjectNotNull("mustNotList", mustNotList);
    assertObjectNotNull("filterList", filterList);
    BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
    mustList.forEach(query -> {
        boolQuery.must(query);
    });
    shouldList.forEach(query -> {
        boolQuery.should(query);
    });
    mustNotList.forEach(query -> {
        boolQuery.mustNot(query);
    });
    filterList.forEach(query -> {
        boolQuery.filter(query);
    });
    regQ(boolQuery);
    return boolQuery;
}
Also used : BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder)

Example 37 with BoolQueryBuilder

use of org.opensearch.index.query.BoolQueryBuilder in project fess by codelibs.

the class BsPathMappingCQ method bool.

public void bool(BoolCall<PathMappingCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
    PathMappingCQ mustQuery = new PathMappingCQ();
    PathMappingCQ shouldQuery = new PathMappingCQ();
    PathMappingCQ mustNotQuery = new PathMappingCQ();
    PathMappingCQ filterQuery = new PathMappingCQ();
    boolLambda.callback(mustQuery, shouldQuery, mustNotQuery, filterQuery);
    if (mustQuery.hasQueries() || shouldQuery.hasQueries() || mustNotQuery.hasQueries() || filterQuery.hasQueries()) {
        BoolQueryBuilder builder = regBoolCQ(mustQuery.getQueryBuilderList(), shouldQuery.getQueryBuilderList(), mustNotQuery.getQueryBuilderList(), filterQuery.getQueryBuilderList());
        if (opLambda != null) {
            opLambda.callback(builder);
        }
    }
}
Also used : PathMappingCQ(org.codelibs.fess.es.config.cbean.cq.PathMappingCQ) BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder)

Example 38 with BoolQueryBuilder

use of org.opensearch.index.query.BoolQueryBuilder in project fess by codelibs.

the class BsRequestHeaderCQ method bool.

public void bool(BoolCall<RequestHeaderCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
    RequestHeaderCQ mustQuery = new RequestHeaderCQ();
    RequestHeaderCQ shouldQuery = new RequestHeaderCQ();
    RequestHeaderCQ mustNotQuery = new RequestHeaderCQ();
    RequestHeaderCQ filterQuery = new RequestHeaderCQ();
    boolLambda.callback(mustQuery, shouldQuery, mustNotQuery, filterQuery);
    if (mustQuery.hasQueries() || shouldQuery.hasQueries() || mustNotQuery.hasQueries() || filterQuery.hasQueries()) {
        BoolQueryBuilder builder = regBoolCQ(mustQuery.getQueryBuilderList(), shouldQuery.getQueryBuilderList(), mustNotQuery.getQueryBuilderList(), filterQuery.getQueryBuilderList());
        if (opLambda != null) {
            opLambda.callback(builder);
        }
    }
}
Also used : RequestHeaderCQ(org.codelibs.fess.es.config.cbean.cq.RequestHeaderCQ) BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder)

Example 39 with BoolQueryBuilder

use of org.opensearch.index.query.BoolQueryBuilder in project fess by codelibs.

the class BsLabelTypeCQ method bool.

public void bool(BoolCall<LabelTypeCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
    LabelTypeCQ mustQuery = new LabelTypeCQ();
    LabelTypeCQ shouldQuery = new LabelTypeCQ();
    LabelTypeCQ mustNotQuery = new LabelTypeCQ();
    LabelTypeCQ filterQuery = new LabelTypeCQ();
    boolLambda.callback(mustQuery, shouldQuery, mustNotQuery, filterQuery);
    if (mustQuery.hasQueries() || shouldQuery.hasQueries() || mustNotQuery.hasQueries() || filterQuery.hasQueries()) {
        BoolQueryBuilder builder = regBoolCQ(mustQuery.getQueryBuilderList(), shouldQuery.getQueryBuilderList(), mustNotQuery.getQueryBuilderList(), filterQuery.getQueryBuilderList());
        if (opLambda != null) {
            opLambda.callback(builder);
        }
    }
}
Also used : BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder) LabelTypeCQ(org.codelibs.fess.es.config.cbean.cq.LabelTypeCQ)

Example 40 with BoolQueryBuilder

use of org.opensearch.index.query.BoolQueryBuilder in project fess by codelibs.

the class BsRoleTypeCQ method bool.

public void bool(BoolCall<RoleTypeCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
    RoleTypeCQ mustQuery = new RoleTypeCQ();
    RoleTypeCQ shouldQuery = new RoleTypeCQ();
    RoleTypeCQ mustNotQuery = new RoleTypeCQ();
    RoleTypeCQ filterQuery = new RoleTypeCQ();
    boolLambda.callback(mustQuery, shouldQuery, mustNotQuery, filterQuery);
    if (mustQuery.hasQueries() || shouldQuery.hasQueries() || mustNotQuery.hasQueries() || filterQuery.hasQueries()) {
        BoolQueryBuilder builder = regBoolCQ(mustQuery.getQueryBuilderList(), shouldQuery.getQueryBuilderList(), mustNotQuery.getQueryBuilderList(), filterQuery.getQueryBuilderList());
        if (opLambda != null) {
            opLambda.callback(builder);
        }
    }
}
Also used : RoleTypeCQ(org.codelibs.fess.es.config.cbean.cq.RoleTypeCQ) BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder)

Aggregations

BoolQueryBuilder (org.opensearch.index.query.BoolQueryBuilder)43 FessConfig (org.codelibs.fess.mylasta.direction.FessConfig)3 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Locale (java.util.Locale)1 Map (java.util.Map)1 PostConstruct (javax.annotation.PostConstruct)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 StringUtil (org.codelibs.core.lang.StringUtil)1 Tuple3 (org.codelibs.core.misc.Tuple3)1 Constants (org.codelibs.fess.Constants)1 SearchRequestType (org.codelibs.fess.entity.SearchRequestParams.SearchRequestType)1 SearchEngineClient (org.codelibs.fess.es.client.SearchEngineClient)1 SearchConditionBuilder (org.codelibs.fess.es.client.SearchEngineClient.SearchConditionBuilder)1 AccessTokenCQ (org.codelibs.fess.es.config.cbean.cq.AccessTokenCQ)1 BadWordCQ (org.codelibs.fess.es.config.cbean.cq.BadWordCQ)1 BoostDocumentRuleCQ (org.codelibs.fess.es.config.cbean.cq.BoostDocumentRuleCQ)1