Search in sources :

Example 1 with FileConfigCQ

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

the class BsFileConfigCQ method bool.

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

Example 2 with FileConfigCQ

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

the class BsFileConfigCQ method functionScore.

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

Example 3 with FileConfigCQ

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

the class BsFileConfigCA method filter.

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

Aggregations

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