Search in sources :

Example 1 with AccessTokenCQ

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

the class BsAccessTokenCA method filter.

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

Example 2 with AccessTokenCQ

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

the class BsAccessTokenCQ method bool.

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

Example 3 with AccessTokenCQ

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

the class BsAccessTokenCQ method functionScore.

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

Aggregations

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