Search in sources :

Example 1 with LabelTypeCQ

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

the class BsLabelTypeCA method filter.

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

Example 2 with LabelTypeCQ

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

the class BsLabelTypeCQ method bool.

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

Example 3 with LabelTypeCQ

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

the class BsLabelTypeCQ method functionScore.

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

Aggregations

LabelTypeCQ (org.codelibs.fess.es.config.cbean.cq.LabelTypeCQ)3 ArrayList (java.util.ArrayList)1 LabelTypeCA (org.codelibs.fess.es.config.cbean.ca.LabelTypeCA)1 BsLabelTypeCQ (org.codelibs.fess.es.config.cbean.cq.bs.BsLabelTypeCQ)1 BoolQueryBuilder (org.opensearch.index.query.BoolQueryBuilder)1 FunctionScoreQueryBuilder (org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder)1 FilterFunctionBuilder (org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder.FilterFunctionBuilder)1 FilterAggregationBuilder (org.opensearch.search.aggregations.bucket.filter.FilterAggregationBuilder)1