use of org.opensearch.index.query.BoolQueryBuilder in project fess by codelibs.
the class EsAbstractConditionQuery method getQuery.
public QueryBuilder getQuery() {
if (queryBuilderList == null) {
return null;
} else if (queryBuilderList.size() == 1) {
return queryBuilderList.get(0);
}
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
queryBuilderList.forEach(query -> {
boolQuery.must(query);
});
return boolQuery;
}
use of org.opensearch.index.query.BoolQueryBuilder in project fess by codelibs.
the class EsAbstractConditionQuery method regBoolCQ.
protected BoolQueryBuilder regBoolCQ(List<QueryBuilder> mustList, List<QueryBuilder> shouldList, List<QueryBuilder> mustNotList, List<QueryBuilder> filterList) {
assertObjectNotNull("mustList", mustList);
assertObjectNotNull("shouldList", shouldList);
assertObjectNotNull("mustNotList", mustNotList);
assertObjectNotNull("filterList", filterList);
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
mustList.forEach(query -> {
boolQuery.must(query);
});
shouldList.forEach(query -> {
boolQuery.should(query);
});
mustNotList.forEach(query -> {
boolQuery.mustNot(query);
});
filterList.forEach(query -> {
boolQuery.filter(query);
});
regQ(boolQuery);
return boolQuery;
}
use of org.opensearch.index.query.BoolQueryBuilder in project fess by codelibs.
the class BsThumbnailQueueCQ method bool.
public void bool(BoolCall<ThumbnailQueueCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
ThumbnailQueueCQ mustQuery = new ThumbnailQueueCQ();
ThumbnailQueueCQ shouldQuery = new ThumbnailQueueCQ();
ThumbnailQueueCQ mustNotQuery = new ThumbnailQueueCQ();
ThumbnailQueueCQ filterQuery = new ThumbnailQueueCQ();
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.opensearch.index.query.BoolQueryBuilder 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.opensearch.index.query.BoolQueryBuilder in project fess by codelibs.
the class BsScheduledJobCQ method bool.
public void bool(BoolCall<ScheduledJobCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
ScheduledJobCQ mustQuery = new ScheduledJobCQ();
ScheduledJobCQ shouldQuery = new ScheduledJobCQ();
ScheduledJobCQ mustNotQuery = new ScheduledJobCQ();
ScheduledJobCQ filterQuery = new ScheduledJobCQ();
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);
}
}
}
Aggregations