Search in sources :

Example 1 with FailureUrlCQ

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

the class BsFailureUrlCA method filter.

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

Example 2 with FailureUrlCQ

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

the class BsFailureUrlCQ method functionScore.

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

Example 3 with FailureUrlCQ

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

the class BsFailureUrlCQ method bool.

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

Aggregations

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