use of org.opensearch.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.opensearch.index.query.BoolQueryBuilder in project fess by codelibs.
the class BsFailureUrlCQ method bool.
public void bool(BoolCall<FailureUrlCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
FailureUrlCQ mustQuery = new FailureUrlCQ();
FailureUrlCQ shouldQuery = new FailureUrlCQ();
FailureUrlCQ mustNotQuery = new FailureUrlCQ();
FailureUrlCQ filterQuery = new FailureUrlCQ();
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 BsFileConfigCQ method bool.
public void bool(BoolCall<FileConfigCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
FileConfigCQ mustQuery = new FileConfigCQ();
FileConfigCQ shouldQuery = new FileConfigCQ();
FileConfigCQ mustNotQuery = new FileConfigCQ();
FileConfigCQ filterQuery = new FileConfigCQ();
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 BsKeyMatchCQ method bool.
public void bool(BoolCall<KeyMatchCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
KeyMatchCQ mustQuery = new KeyMatchCQ();
KeyMatchCQ shouldQuery = new KeyMatchCQ();
KeyMatchCQ mustNotQuery = new KeyMatchCQ();
KeyMatchCQ filterQuery = new KeyMatchCQ();
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 SearchHelper method getDocumentByDocId.
public OptionalEntity<Map<String, Object>> getDocumentByDocId(final String docId, final String[] fields, final OptionalThing<FessUserBean> userBean) {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
return ComponentUtil.getSearchEngineClient().getDocument(fessConfig.getIndexDocumentSearchIndex(), builder -> {
final BoolQueryBuilder boolQuery = QueryBuilders.boolQuery().must(QueryBuilders.termQuery(fessConfig.getIndexFieldDocId(), docId));
// TODO SearchRequestType?
final Set<String> roleSet = ComponentUtil.getRoleQueryHelper().build(SearchRequestType.JSON);
final QueryHelper queryHelper = ComponentUtil.getQueryHelper();
if (!roleSet.isEmpty()) {
queryHelper.buildRoleQuery(roleSet, boolQuery);
}
builder.setQuery(boolQuery);
builder.setFetchSource(fields, null);
queryHelper.processSearchPreference(builder, userBean, docId);
return true;
});
}
Aggregations