Search in sources :

Example 1 with RelatedQueryCQ

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

the class BsRelatedQueryCQ method bool.

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

Example 2 with RelatedQueryCQ

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

the class BsRelatedQueryCQ method functionScore.

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

Example 3 with RelatedQueryCQ

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

the class BsRelatedQueryCA method filter.

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

Aggregations

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