Search in sources :

Example 1 with GroupCQ

use of org.codelibs.fess.es.user.cbean.cq.GroupCQ in project fess by codelibs.

the class BsGroupCA method filter.

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

Example 2 with GroupCQ

use of org.codelibs.fess.es.user.cbean.cq.GroupCQ in project fess by codelibs.

the class BsGroupCQ method bool.

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

Example 3 with GroupCQ

use of org.codelibs.fess.es.user.cbean.cq.GroupCQ in project fess by codelibs.

the class BsGroupCQ method functionScore.

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

Aggregations

GroupCQ (org.codelibs.fess.es.user.cbean.cq.GroupCQ)3 ArrayList (java.util.ArrayList)1 GroupCA (org.codelibs.fess.es.user.cbean.ca.GroupCA)1 BsGroupCQ (org.codelibs.fess.es.user.cbean.cq.bs.BsGroupCQ)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