Search in sources :

Example 1 with SearchFieldLogCQ

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

the class BsSearchFieldLogCA method filter.

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

Example 2 with SearchFieldLogCQ

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

the class BsSearchFieldLogCQ method bool.

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

Example 3 with SearchFieldLogCQ

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

the class BsSearchFieldLogCQ method functionScore.

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

Aggregations

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