Search in sources :

Example 1 with BadWordCQ

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

the class BsBadWordCA method filter.

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

Example 2 with BadWordCQ

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

the class BsBadWordCQ method functionScore.

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

Example 3 with BadWordCQ

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

the class BsBadWordCQ method bool.

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

Aggregations

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