Search in sources :

Example 1 with WebAuthenticationCQ

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

the class BsWebAuthenticationCA method filter.

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

Example 2 with WebAuthenticationCQ

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

the class BsWebAuthenticationCQ method functionScore.

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

Example 3 with WebAuthenticationCQ

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

the class BsWebAuthenticationCQ method bool.

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

Aggregations

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