Search in sources :

Example 1 with WebConfigCQ

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

the class BsWebConfigCA method filter.

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

Example 2 with WebConfigCQ

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

the class BsWebConfigCQ method functionScore.

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

Example 3 with WebConfigCQ

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

the class BsWebConfigCQ method bool.

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

Aggregations

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