Search in sources :

Example 1 with FileAuthenticationCQ

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

the class BsFileAuthenticationCQ method bool.

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

Example 2 with FileAuthenticationCQ

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

the class BsFileAuthenticationCA method filter.

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

Example 3 with FileAuthenticationCQ

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

the class BsFileAuthenticationCQ method functionScore.

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

Aggregations

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