Search in sources :

Example 1 with DataConfigToRoleCQ

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

the class BsDataConfigToRoleCA method filter.

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

Example 2 with DataConfigToRoleCQ

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

the class BsDataConfigToRoleCQ method functionScore.

// ===================================================================================
//                                                                       Query Control
//                                                                       =============
public void functionScore(OperatorCall<DataConfigToRoleCQ> queryLambda, ScoreFunctionCall<ScoreFunctionCreator<DataConfigToRoleCQ>> functionsLambda, final ConditionOptionCall<FunctionScoreQueryBuilder> opLambda) {
    DataConfigToRoleCQ cq = new DataConfigToRoleCQ();
    queryLambda.callback(cq);
    final Collection<FilterFunctionBuilder> list = new ArrayList<>();
    if (functionsLambda != null) {
        functionsLambda.callback((cqLambda, scoreFunctionBuilder) -> {
            DataConfigToRoleCQ cf = new DataConfigToRoleCQ();
            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.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder) FilterFunctionBuilder(org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder.FilterFunctionBuilder) DataConfigToRoleCQ(org.codelibs.fess.es.config.cbean.cq.DataConfigToRoleCQ) ArrayList(java.util.ArrayList)

Example 3 with DataConfigToRoleCQ

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

the class BsDataConfigToRoleCQ method bool.

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

Aggregations

DataConfigToRoleCQ (org.codelibs.fess.es.config.cbean.cq.DataConfigToRoleCQ)3 ArrayList (java.util.ArrayList)1 DataConfigToRoleCA (org.codelibs.fess.es.config.cbean.ca.DataConfigToRoleCA)1 BsDataConfigToRoleCQ (org.codelibs.fess.es.config.cbean.cq.bs.BsDataConfigToRoleCQ)1 BoolQueryBuilder (org.elasticsearch.index.query.BoolQueryBuilder)1 FunctionScoreQueryBuilder (org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder)1 FilterFunctionBuilder (org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder.FilterFunctionBuilder)1 FilterAggregationBuilder (org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder)1