Search in sources :

Example 11 with FilterFunctionBuilder

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

the class BsDataConfigToLabelCQ method functionScore.

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

Example 12 with FilterFunctionBuilder

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

the class BsSearchFieldLogCQ method functionScore.

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

Example 13 with FilterFunctionBuilder

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

the class BsLabelToRoleCQ method functionScore.

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

Example 14 with FilterFunctionBuilder

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

the class BsFileConfigToLabelCQ method functionScore.

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

Example 15 with FilterFunctionBuilder

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

the class BsFileConfigToRoleCQ method functionScore.

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

Aggregations

FilterFunctionBuilder (org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder.FilterFunctionBuilder)15 ArrayList (java.util.ArrayList)10 FunctionScoreQueryBuilder (org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder)9 SearchResponse (org.elasticsearch.action.search.SearchResponse)5 GeoPoint (org.elasticsearch.common.geo.GeoPoint)3 MatchAllQueryBuilder (org.elasticsearch.index.query.MatchAllQueryBuilder)3 SearchHits (org.elasticsearch.search.SearchHits)3 ElasticsearchAssertions.assertOrderedSearchHits (org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertOrderedSearchHits)3 ElasticsearchAssertions.assertSearchHits (org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits)3 IndexRequestBuilder (org.elasticsearch.action.index.IndexRequestBuilder)2 Script (org.elasticsearch.script.Script)2 ElasticsearchAssertions.assertSearchResponse (org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse)2 DataConfigToLabelCQ (org.codelibs.fess.es.config.cbean.cq.DataConfigToLabelCQ)1 DataConfigToRoleCQ (org.codelibs.fess.es.config.cbean.cq.DataConfigToRoleCQ)1 FileConfigToLabelCQ (org.codelibs.fess.es.config.cbean.cq.FileConfigToLabelCQ)1 FileConfigToRoleCQ (org.codelibs.fess.es.config.cbean.cq.FileConfigToRoleCQ)1 LabelToRoleCQ (org.codelibs.fess.es.config.cbean.cq.LabelToRoleCQ)1 WebConfigToLabelCQ (org.codelibs.fess.es.config.cbean.cq.WebConfigToLabelCQ)1 WebConfigToRoleCQ (org.codelibs.fess.es.config.cbean.cq.WebConfigToRoleCQ)1 SearchFieldLogCQ (org.codelibs.fess.es.log.cbean.cq.SearchFieldLogCQ)1