Search in sources :

Example 6 with FunctionScoreQueryBuilder

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

the class BsBoostDocumentRuleCQ method functionScore.

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

Example 7 with FunctionScoreQueryBuilder

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

the class BsDataConfigCQ method functionScore.

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

Example 8 with FunctionScoreQueryBuilder

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

the class BsDataConfigToRoleCQ method functionScore.

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

Example 9 with FunctionScoreQueryBuilder

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

the class BsElevateWordCQ method functionScore.

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

Example 10 with FunctionScoreQueryBuilder

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

the class BsFailureUrlCQ method functionScore.

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

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