use of org.elasticsearch.index.query.BoolQueryBuilder in project fess by codelibs.
the class BsSearchLogCQ method bool.
public void bool(BoolCall<SearchLogCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
SearchLogCQ mustQuery = new SearchLogCQ();
SearchLogCQ shouldQuery = new SearchLogCQ();
SearchLogCQ mustNotQuery = new SearchLogCQ();
SearchLogCQ filterQuery = new SearchLogCQ();
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.elasticsearch.index.query.BoolQueryBuilder in project fess by codelibs.
the class BsGroupCQ method bool.
public void bool(BoolCall<GroupCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
GroupCQ mustQuery = new GroupCQ();
GroupCQ shouldQuery = new GroupCQ();
GroupCQ mustNotQuery = new GroupCQ();
GroupCQ filterQuery = new GroupCQ();
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.elasticsearch.index.query.BoolQueryBuilder in project fess by codelibs.
the class BsRoleCQ method bool.
public void bool(BoolCall<RoleCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
RoleCQ mustQuery = new RoleCQ();
RoleCQ shouldQuery = new RoleCQ();
RoleCQ mustNotQuery = new RoleCQ();
RoleCQ filterQuery = new RoleCQ();
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.elasticsearch.index.query.BoolQueryBuilder in project fess by codelibs.
the class SuggestHelper method purgeSearchlogSuggest.
public void purgeSearchlogSuggest(final LocalDateTime time) {
final BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
boolQueryBuilder.must(QueryBuilders.rangeQuery(FieldNames.TIMESTAMP).lt(time.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
boolQueryBuilder.mustNot(QueryBuilders.termQuery(FieldNames.KINDS, SuggestItem.Kind.DOCUMENT.toString()));
boolQueryBuilder.must(QueryBuilders.termQuery(FieldNames.KINDS, SuggestItem.Kind.QUERY.toString()));
boolQueryBuilder.mustNot(QueryBuilders.termQuery(FieldNames.KINDS, SuggestItem.Kind.USER.toString()));
SuggestUtil.deleteByQuery(fessEsClient, suggester.getIndex(), suggester.getType(), boolQueryBuilder);
}
use of org.elasticsearch.index.query.BoolQueryBuilder in project fess by codelibs.
the class QueryHelper method buildRoleQuery.
protected void buildRoleQuery(final QueryContext queryContext, final SearchRequestType searchRequestType) {
if (roleQueryHelper != null && queryContext.roleQueryEnabled()) {
final Set<String> roleSet = roleQueryHelper.build(searchRequestType);
if (!roleSet.isEmpty()) {
queryContext.addQuery(boolQuery -> {
final BoolQueryBuilder roleQuery = QueryBuilders.boolQuery();
roleSet.stream().forEach(name -> {
roleQuery.should(QueryBuilders.termQuery(fessConfig.getIndexFieldRole(), name));
});
boolQuery.filter(roleQuery);
});
}
}
}
Aggregations