Search in sources :

Example 1 with RoleTypeCQ

use of org.codelibs.fess.es.config.cbean.cq.RoleTypeCQ in project fess by codelibs.

the class BsRoleTypeCA method filter.

// ===================================================================================
// Aggregation Set
// =========
public void filter(String name, EsAbstractConditionQuery.OperatorCall<BsRoleTypeCQ> queryLambda, ConditionOptionCall<FilterAggregationBuilder> opLambda, OperatorCall<BsRoleTypeCA> aggsLambda) {
    RoleTypeCQ cq = new RoleTypeCQ();
    if (queryLambda != null) {
        queryLambda.callback(cq);
    }
    FilterAggregationBuilder builder = regFilterA(name, cq.getQuery());
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        RoleTypeCA ca = new RoleTypeCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
Also used : FilterAggregationBuilder(org.opensearch.search.aggregations.bucket.filter.FilterAggregationBuilder) RoleTypeCQ(org.codelibs.fess.es.config.cbean.cq.RoleTypeCQ) BsRoleTypeCQ(org.codelibs.fess.es.config.cbean.cq.bs.BsRoleTypeCQ) RoleTypeCA(org.codelibs.fess.es.config.cbean.ca.RoleTypeCA)

Example 2 with RoleTypeCQ

use of org.codelibs.fess.es.config.cbean.cq.RoleTypeCQ in project fess by codelibs.

the class BsRoleTypeCQ method functionScore.

// ===================================================================================
// Query Control
// =============
public void functionScore(OperatorCall<RoleTypeCQ> queryLambda, ScoreFunctionCall<ScoreFunctionCreator<RoleTypeCQ>> functionsLambda, final ConditionOptionCall<FunctionScoreQueryBuilder> opLambda) {
    RoleTypeCQ cq = new RoleTypeCQ();
    queryLambda.callback(cq);
    final Collection<FilterFunctionBuilder> list = new ArrayList<>();
    if (functionsLambda != null) {
        functionsLambda.callback((cqLambda, scoreFunctionBuilder) -> {
            RoleTypeCQ cf = new RoleTypeCQ();
            cqLambda.callback(cf);
            list.add(new FilterFunctionBuilder(cf.getQuery(), scoreFunctionBuilder));
        });
    }
    final FunctionScoreQueryBuilder builder = regFunctionScoreQ(cq.getQuery(), list);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
Also used : FunctionScoreQueryBuilder(org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder) FilterFunctionBuilder(org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder.FilterFunctionBuilder) RoleTypeCQ(org.codelibs.fess.es.config.cbean.cq.RoleTypeCQ) ArrayList(java.util.ArrayList)

Example 3 with RoleTypeCQ

use of org.codelibs.fess.es.config.cbean.cq.RoleTypeCQ 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

RoleTypeCQ (org.codelibs.fess.es.config.cbean.cq.RoleTypeCQ)3 ArrayList (java.util.ArrayList)1 RoleTypeCA (org.codelibs.fess.es.config.cbean.ca.RoleTypeCA)1 BsRoleTypeCQ (org.codelibs.fess.es.config.cbean.cq.bs.BsRoleTypeCQ)1 BoolQueryBuilder (org.opensearch.index.query.BoolQueryBuilder)1 FunctionScoreQueryBuilder (org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder)1 FilterFunctionBuilder (org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder.FilterFunctionBuilder)1 FilterAggregationBuilder (org.opensearch.search.aggregations.bucket.filter.FilterAggregationBuilder)1