Search in sources :

Example 1 with DataConfigCQ

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

the class BsDataConfigCQ method functionScore.

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

Example 2 with DataConfigCQ

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

the class BsDataConfigCQ method bool.

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

Example 3 with DataConfigCQ

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

the class BsDataConfigCA method filter.

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

Aggregations

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