Search in sources :

Example 1 with FavoriteLogCQ

use of org.codelibs.fess.es.log.cbean.cq.FavoriteLogCQ in project fess by codelibs.

the class BsFavoriteLogCA method filter.

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

Example 2 with FavoriteLogCQ

use of org.codelibs.fess.es.log.cbean.cq.FavoriteLogCQ in project fess by codelibs.

the class BsFavoriteLogCQ method bool.

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

Example 3 with FavoriteLogCQ

use of org.codelibs.fess.es.log.cbean.cq.FavoriteLogCQ in project fess by codelibs.

the class BsFavoriteLogCQ method functionScore.

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

Aggregations

FavoriteLogCQ (org.codelibs.fess.es.log.cbean.cq.FavoriteLogCQ)3 ArrayList (java.util.ArrayList)1 FavoriteLogCA (org.codelibs.fess.es.log.cbean.ca.FavoriteLogCA)1 BsFavoriteLogCQ (org.codelibs.fess.es.log.cbean.cq.bs.BsFavoriteLogCQ)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