Search in sources :

Example 1 with RequestHeaderCQ

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

the class BsRequestHeaderCQ method functionScore.

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

Example 2 with RequestHeaderCQ

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

the class BsRequestHeaderCQ method bool.

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

Example 3 with RequestHeaderCQ

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

the class BsRequestHeaderCA method filter.

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

Aggregations

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