Search in sources :

Example 1 with KeyMatchCQ

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

the class BsKeyMatchCQ method bool.

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

Example 2 with KeyMatchCQ

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

the class BsKeyMatchCA method filter.

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

Example 3 with KeyMatchCQ

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

the class BsKeyMatchCQ method functionScore.

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

Aggregations

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