Search in sources :

Example 1 with WebConfigToLabelCQ

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

the class BsWebConfigToLabelCA method filter.

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

Example 2 with WebConfigToLabelCQ

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

the class BsWebConfigToLabelCQ method bool.

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

Example 3 with WebConfigToLabelCQ

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

the class BsWebConfigToLabelCQ method functionScore.

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

Aggregations

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