Search in sources :

Example 16 with BoolQueryBuilder

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);
        }
    }
}
Also used : BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder) RoleCQ(org.codelibs.fess.es.user.cbean.cq.RoleCQ)

Example 17 with BoolQueryBuilder

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);
        }
    }
}
Also used : BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder) FailureUrlCQ(org.codelibs.fess.es.config.cbean.cq.FailureUrlCQ)

Example 18 with BoolQueryBuilder

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);
        }
    }
}
Also used : BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder) FileConfigCQ(org.codelibs.fess.es.config.cbean.cq.FileConfigCQ)

Example 19 with BoolQueryBuilder

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);
        }
    }
}
Also used : BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder) KeyMatchCQ(org.codelibs.fess.es.config.cbean.cq.KeyMatchCQ)

Example 20 with BoolQueryBuilder

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;
    });
}
Also used : BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig)

Aggregations

BoolQueryBuilder (org.opensearch.index.query.BoolQueryBuilder)43 FessConfig (org.codelibs.fess.mylasta.direction.FessConfig)3 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Locale (java.util.Locale)1 Map (java.util.Map)1 PostConstruct (javax.annotation.PostConstruct)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 StringUtil (org.codelibs.core.lang.StringUtil)1 Tuple3 (org.codelibs.core.misc.Tuple3)1 Constants (org.codelibs.fess.Constants)1 SearchRequestType (org.codelibs.fess.entity.SearchRequestParams.SearchRequestType)1 SearchEngineClient (org.codelibs.fess.es.client.SearchEngineClient)1 SearchConditionBuilder (org.codelibs.fess.es.client.SearchEngineClient.SearchConditionBuilder)1 AccessTokenCQ (org.codelibs.fess.es.config.cbean.cq.AccessTokenCQ)1 BadWordCQ (org.codelibs.fess.es.config.cbean.cq.BadWordCQ)1 BoostDocumentRuleCQ (org.codelibs.fess.es.config.cbean.cq.BoostDocumentRuleCQ)1