Search in sources :

Example 1 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 2 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 3 with BoolQueryBuilder

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

the class BsThumbnailQueueCQ method bool.

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

Example 4 with BoolQueryBuilder

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

the class BsRelatedQueryCQ method bool.

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

Example 5 with BoolQueryBuilder

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

the class BsScheduledJobCQ method bool.

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

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