use of org.opensearch.index.query.BoolQueryBuilder in project fess by codelibs.
the class BsWebConfigCQ method bool.
public void bool(BoolCall<WebConfigCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
WebConfigCQ mustQuery = new WebConfigCQ();
WebConfigCQ shouldQuery = new WebConfigCQ();
WebConfigCQ mustNotQuery = new WebConfigCQ();
WebConfigCQ filterQuery = new WebConfigCQ();
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 QueryContext method addQuery.
public void addQuery(final Consumer<BoolQueryBuilder> boolQuery) {
BoolQueryBuilder builder;
if (queryBuilder instanceof MatchAllQueryBuilder) {
builder = QueryBuilders.boolQuery();
} else {
builder = QueryBuilders.boolQuery().must(queryBuilder);
}
boolQuery.accept(builder);
if (builder.hasClauses()) {
queryBuilder = builder;
}
}
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 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 BsUserInfoCQ method bool.
public void bool(BoolCall<UserInfoCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
UserInfoCQ mustQuery = new UserInfoCQ();
UserInfoCQ shouldQuery = new UserInfoCQ();
UserInfoCQ mustNotQuery = new UserInfoCQ();
UserInfoCQ filterQuery = new UserInfoCQ();
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