use of org.codelibs.fess.es.config.cbean.cq.RelatedQueryCQ in project fess by codelibs.
the class BsRelatedQueryCQ method bool.
public void bool(BoolCall<RelatedQueryCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
RelatedQueryCQ mustQuery = new RelatedQueryCQ();
RelatedQueryCQ shouldQuery = new RelatedQueryCQ();
RelatedQueryCQ mustNotQuery = new RelatedQueryCQ();
RelatedQueryCQ filterQuery = new RelatedQueryCQ();
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);
}
}
}
use of org.codelibs.fess.es.config.cbean.cq.RelatedQueryCQ in project fess by codelibs.
the class BsRelatedQueryCQ method functionScore.
// ===================================================================================
// Query Control
// =============
public void functionScore(OperatorCall<RelatedQueryCQ> queryLambda, ScoreFunctionCall<ScoreFunctionCreator<RelatedQueryCQ>> functionsLambda, final ConditionOptionCall<FunctionScoreQueryBuilder> opLambda) {
RelatedQueryCQ cq = new RelatedQueryCQ();
queryLambda.callback(cq);
final Collection<FilterFunctionBuilder> list = new ArrayList<>();
if (functionsLambda != null) {
functionsLambda.callback((cqLambda, scoreFunctionBuilder) -> {
RelatedQueryCQ cf = new RelatedQueryCQ();
cqLambda.callback(cf);
list.add(new FilterFunctionBuilder(cf.getQuery(), scoreFunctionBuilder));
});
}
final FunctionScoreQueryBuilder builder = regFunctionScoreQ(cq.getQuery(), list);
if (opLambda != null) {
opLambda.callback(builder);
}
}
use of org.codelibs.fess.es.config.cbean.cq.RelatedQueryCQ in project fess by codelibs.
the class BsRelatedQueryCA method filter.
// ===================================================================================
// Aggregation Set
// =========
public void filter(String name, EsAbstractConditionQuery.OperatorCall<BsRelatedQueryCQ> queryLambda, ConditionOptionCall<FilterAggregationBuilder> opLambda, OperatorCall<BsRelatedQueryCA> aggsLambda) {
RelatedQueryCQ cq = new RelatedQueryCQ();
if (queryLambda != null) {
queryLambda.callback(cq);
}
FilterAggregationBuilder builder = regFilterA(name, cq.getQuery());
if (opLambda != null) {
opLambda.callback(builder);
}
if (aggsLambda != null) {
RelatedQueryCA ca = new RelatedQueryCA();
aggsLambda.callback(ca);
ca.getAggregationBuilderList().forEach(builder::subAggregation);
}
}
Aggregations