Search in sources :

Example 11 with FunctionScoreQueryBuilder

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

the class BsFileConfigCQ method functionScore.

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

Example 12 with FunctionScoreQueryBuilder

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

the class BsThumbnailQueueCQ method functionScore.

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

Example 13 with FunctionScoreQueryBuilder

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

the class BsScheduledJobCQ method functionScore.

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

Example 14 with FunctionScoreQueryBuilder

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

the class BsWebAuthenticationCQ method functionScore.

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

Example 15 with FunctionScoreQueryBuilder

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

the class BsWebConfigCQ method functionScore.

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

Aggregations

FunctionScoreQueryBuilder (org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder)47 FilterFunctionBuilder (org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder.FilterFunctionBuilder)40 ArrayList (java.util.ArrayList)38 SearchResponse (org.elasticsearch.action.search.SearchResponse)4 BoolQueryBuilder (org.elasticsearch.index.query.BoolQueryBuilder)2 BoostingQueryBuilder (org.elasticsearch.index.query.BoostingQueryBuilder)2 ConstantScoreQueryBuilder (org.elasticsearch.index.query.ConstantScoreQueryBuilder)2 HasChildQueryBuilder (org.elasticsearch.index.query.HasChildQueryBuilder)2 HasParentQueryBuilder (org.elasticsearch.index.query.HasParentQueryBuilder)2 RangeQueryBuilder (org.elasticsearch.index.query.RangeQueryBuilder)2 RandomScoreFunctionBuilder (org.elasticsearch.index.query.functionscore.RandomScoreFunctionBuilder)2 SearchHits (org.elasticsearch.search.SearchHits)2 Field (org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder.Field)2 ElasticsearchAssertions.assertOrderedSearchHits (org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertOrderedSearchHits)2 ElasticsearchAssertions.assertSearchHits (org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits)2 ElasticsearchAssertions.assertSearchResponse (org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 HashMap (java.util.HashMap)1 List (java.util.List)1 AccessTokenCQ (org.codelibs.fess.es.config.cbean.cq.AccessTokenCQ)1