Search in sources :

Example 1 with WebConfigToRoleCQ

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

the class BsWebConfigToRoleCQ method functionScore.

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

Example 2 with WebConfigToRoleCQ

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

the class BsWebConfigToRoleCQ method bool.

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

Example 3 with WebConfigToRoleCQ

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

the class BsWebConfigToRoleCA method filter.

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

Aggregations

WebConfigToRoleCQ (org.codelibs.fess.es.config.cbean.cq.WebConfigToRoleCQ)3 ArrayList (java.util.ArrayList)1 WebConfigToRoleCA (org.codelibs.fess.es.config.cbean.ca.WebConfigToRoleCA)1 BsWebConfigToRoleCQ (org.codelibs.fess.es.config.cbean.cq.bs.BsWebConfigToRoleCQ)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