Search in sources :

Example 1 with BoostDocumentRuleCQ

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

the class BsBoostDocumentRuleCQ method bool.

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

Example 2 with BoostDocumentRuleCQ

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

the class BsBoostDocumentRuleCQ method functionScore.

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

Example 3 with BoostDocumentRuleCQ

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

the class BsBoostDocumentRuleCA method filter.

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

Aggregations

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