Search in sources :

Example 1 with FileConfigToRoleCQ

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

the class BsFileConfigToRoleCQ method bool.

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

Example 2 with FileConfigToRoleCQ

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

the class BsFileConfigToRoleCQ method functionScore.

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

Example 3 with FileConfigToRoleCQ

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

the class BsFileConfigToRoleCA method filter.

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

Aggregations

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