Search in sources :

Example 1 with RelatedContentCQ

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

the class BsRelatedContentCQ method bool.

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

Example 2 with RelatedContentCQ

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

the class BsRelatedContentCA method filter.

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

Example 3 with RelatedContentCQ

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

the class BsRelatedContentCQ method functionScore.

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

Aggregations

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