Search in sources :

Example 16 with FunctionScoreQueryBuilder

use of org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder in project fess by codelibs.

the class EsAbstractConditionQuery method regFunctionScoreQ.

// ===================================================================================
// Register
// ========
protected FunctionScoreQueryBuilder regFunctionScoreQ(QueryBuilder queryBuilder, Collection<FilterFunctionBuilder> list) {
    FunctionScoreQueryBuilder functionScoreQuery = QueryBuilders.functionScoreQuery(queryBuilder, list.toArray(new FilterFunctionBuilder[list.size()]));
    regQ(functionScoreQuery);
    return functionScoreQuery;
}
Also used : FunctionScoreQueryBuilder(org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder) FilterFunctionBuilder(org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder.FilterFunctionBuilder)

Example 17 with FunctionScoreQueryBuilder

use of org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder in project fess by codelibs.

the class EsAbstractConditionQuery method regFunctionScoreQ.

// ===================================================================================
// Register
// ========
protected FunctionScoreQueryBuilder regFunctionScoreQ(QueryBuilder queryBuilder, Collection<FilterFunctionBuilder> list) {
    FunctionScoreQueryBuilder functionScoreQuery = QueryBuilders.functionScoreQuery(queryBuilder, list.toArray(new FilterFunctionBuilder[list.size()]));
    regQ(functionScoreQuery);
    return functionScoreQuery;
}
Also used : FunctionScoreQueryBuilder(org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder) FilterFunctionBuilder(org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder.FilterFunctionBuilder)

Example 18 with FunctionScoreQueryBuilder

use of org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder in project fess by codelibs.

the class BsUserInfoCQ method functionScore.

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

Example 19 with FunctionScoreQueryBuilder

use of org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder in project fess by codelibs.

the class BsFavoriteLogCQ method functionScore.

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

Example 20 with FunctionScoreQueryBuilder

use of org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder in project fess by codelibs.

the class BsDuplicateHostCQ method functionScore.

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

Aggregations

FunctionScoreQueryBuilder (org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder)34 FilterFunctionBuilder (org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder.FilterFunctionBuilder)34 ArrayList (java.util.ArrayList)31 AccessTokenCQ (org.codelibs.fess.es.config.cbean.cq.AccessTokenCQ)1 BadWordCQ (org.codelibs.fess.es.config.cbean.cq.BadWordCQ)1 BoostDocumentRuleCQ (org.codelibs.fess.es.config.cbean.cq.BoostDocumentRuleCQ)1 CrawlingInfoCQ (org.codelibs.fess.es.config.cbean.cq.CrawlingInfoCQ)1 CrawlingInfoParamCQ (org.codelibs.fess.es.config.cbean.cq.CrawlingInfoParamCQ)1 DataConfigCQ (org.codelibs.fess.es.config.cbean.cq.DataConfigCQ)1 DuplicateHostCQ (org.codelibs.fess.es.config.cbean.cq.DuplicateHostCQ)1 ElevateWordCQ (org.codelibs.fess.es.config.cbean.cq.ElevateWordCQ)1 ElevateWordToLabelCQ (org.codelibs.fess.es.config.cbean.cq.ElevateWordToLabelCQ)1 FailureUrlCQ (org.codelibs.fess.es.config.cbean.cq.FailureUrlCQ)1 FileAuthenticationCQ (org.codelibs.fess.es.config.cbean.cq.FileAuthenticationCQ)1 FileConfigCQ (org.codelibs.fess.es.config.cbean.cq.FileConfigCQ)1 JobLogCQ (org.codelibs.fess.es.config.cbean.cq.JobLogCQ)1 KeyMatchCQ (org.codelibs.fess.es.config.cbean.cq.KeyMatchCQ)1 LabelTypeCQ (org.codelibs.fess.es.config.cbean.cq.LabelTypeCQ)1 PathMappingCQ (org.codelibs.fess.es.config.cbean.cq.PathMappingCQ)1 RelatedContentCQ (org.codelibs.fess.es.config.cbean.cq.RelatedContentCQ)1