Search in sources :

Example 26 with BoolQueryBuilder

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

the class BsWebConfigCQ method bool.

public void bool(BoolCall<WebConfigCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
    WebConfigCQ mustQuery = new WebConfigCQ();
    WebConfigCQ shouldQuery = new WebConfigCQ();
    WebConfigCQ mustNotQuery = new WebConfigCQ();
    WebConfigCQ filterQuery = new WebConfigCQ();
    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) WebConfigCQ(org.codelibs.fess.es.config.cbean.cq.WebConfigCQ)

Example 27 with BoolQueryBuilder

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

the class QueryContext method addQuery.

public void addQuery(final Consumer<BoolQueryBuilder> boolQuery) {
    BoolQueryBuilder builder;
    if (queryBuilder instanceof MatchAllQueryBuilder) {
        builder = QueryBuilders.boolQuery();
    } else {
        builder = QueryBuilders.boolQuery().must(queryBuilder);
    }
    boolQuery.accept(builder);
    if (builder.hasClauses()) {
        queryBuilder = builder;
    }
}
Also used : BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder) MatchAllQueryBuilder(org.opensearch.index.query.MatchAllQueryBuilder)

Example 28 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 29 with BoolQueryBuilder

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

the class EsAbstractConditionQuery method getQuery.

public QueryBuilder getQuery() {
    if (queryBuilderList == null) {
        return null;
    } else if (queryBuilderList.size() == 1) {
        return queryBuilderList.get(0);
    }
    BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
    queryBuilderList.forEach(query -> {
        boolQuery.must(query);
    });
    return boolQuery;
}
Also used : BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder)

Example 30 with BoolQueryBuilder

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

the class BsUserInfoCQ method bool.

public void bool(BoolCall<UserInfoCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
    UserInfoCQ mustQuery = new UserInfoCQ();
    UserInfoCQ shouldQuery = new UserInfoCQ();
    UserInfoCQ mustNotQuery = new UserInfoCQ();
    UserInfoCQ filterQuery = new UserInfoCQ();
    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) UserInfoCQ(org.codelibs.fess.es.log.cbean.cq.UserInfoCQ)

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