Search in sources :

Example 1 with DataConfigToLabelCQ

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

the class BsDataConfigToLabelCA method filter.

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

Example 2 with DataConfigToLabelCQ

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

the class BsDataConfigToLabelCQ method functionScore.

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

Example 3 with DataConfigToLabelCQ

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

the class BsDataConfigToLabelCQ method bool.

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

Aggregations

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