Search in sources :

Example 6 with QueryBuilder

use of org.opensearch.index.query.QueryBuilder in project fess by codelibs.

the class BsFavoriteLogCB method build.

// ===================================================================================
// Build
// =====
@Override
public SearchRequestBuilder build(SearchRequestBuilder builder) {
    if (_conditionQuery != null) {
        QueryBuilder queryBuilder = _conditionQuery.getQuery();
        if (queryBuilder != null) {
            builder.setQuery(queryBuilder);
        }
        _conditionQuery.getFieldSortBuilderList().forEach(sort -> {
            builder.addSort(sort);
        });
    }
    if (_conditionAggregation != null) {
        _conditionAggregation.getAggregationBuilderList().forEach(builder::addAggregation);
    }
    if (_specification != null) {
        builder.setFetchSource(_specification.columnList.toArray(new String[_specification.columnList.size()]), null);
    }
    return builder;
}
Also used : QueryBuilder(org.opensearch.index.query.QueryBuilder)

Example 7 with QueryBuilder

use of org.opensearch.index.query.QueryBuilder in project fess by codelibs.

the class BsClickLogCB method build.

// ===================================================================================
// Build
// =====
@Override
public SearchRequestBuilder build(SearchRequestBuilder builder) {
    if (_conditionQuery != null) {
        QueryBuilder queryBuilder = _conditionQuery.getQuery();
        if (queryBuilder != null) {
            builder.setQuery(queryBuilder);
        }
        _conditionQuery.getFieldSortBuilderList().forEach(sort -> {
            builder.addSort(sort);
        });
    }
    if (_conditionAggregation != null) {
        _conditionAggregation.getAggregationBuilderList().forEach(builder::addAggregation);
    }
    if (_specification != null) {
        builder.setFetchSource(_specification.columnList.toArray(new String[_specification.columnList.size()]), null);
    }
    return builder;
}
Also used : QueryBuilder(org.opensearch.index.query.QueryBuilder)

Example 8 with QueryBuilder

use of org.opensearch.index.query.QueryBuilder in project fess by codelibs.

the class BsSearchLogCB method build.

// ===================================================================================
// Build
// =====
@Override
public SearchRequestBuilder build(SearchRequestBuilder builder) {
    if (_conditionQuery != null) {
        QueryBuilder queryBuilder = _conditionQuery.getQuery();
        if (queryBuilder != null) {
            builder.setQuery(queryBuilder);
        }
        _conditionQuery.getFieldSortBuilderList().forEach(sort -> {
            builder.addSort(sort);
        });
    }
    if (_conditionAggregation != null) {
        _conditionAggregation.getAggregationBuilderList().forEach(builder::addAggregation);
    }
    if (_specification != null) {
        builder.setFetchSource(_specification.columnList.toArray(new String[_specification.columnList.size()]), null);
    }
    return builder;
}
Also used : QueryBuilder(org.opensearch.index.query.QueryBuilder)

Example 9 with QueryBuilder

use of org.opensearch.index.query.QueryBuilder in project fess by codelibs.

the class AdminSearchlistAction method delete.

// -----------------------------------------------------
// Confirm
// -------
@Execute
@Secured({ ROLE })
public HtmlResponse delete(final DeleteForm form) {
    validate(form, messages -> {
    }, this::asListHtml);
    verifyToken(this::asListHtml);
    final String docId = form.docId;
    try {
        final QueryBuilder query = QueryBuilders.termQuery(fessConfig.getIndexFieldDocId(), docId);
        searchEngineClient.deleteByQuery(fessConfig.getIndexDocumentUpdateIndex(), query);
        saveInfo(messages -> messages.addSuccessDeleteDocFromIndex(GLOBAL));
    } catch (final Exception e) {
        throwValidationError(messages -> messages.addErrorsFailedToDeleteDocInAdmin(GLOBAL), this::asListHtml);
    }
    return asListHtml();
}
Also used : Constants(org.codelibs.fess.Constants) HashMap(java.util.HashMap) SearchEngineClient(org.codelibs.fess.es.client.SearchEngineClient) ResultOffsetExceededException(org.codelibs.fess.exception.ResultOffsetExceededException) ActionRuntime(org.lastaflute.web.ruts.process.ActionRuntime) RenderDataUtil(org.codelibs.fess.util.RenderDataUtil) HttpServletRequest(javax.servlet.http.HttpServletRequest) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig) CrudMode(org.codelibs.fess.app.web.CrudMode) FessAdminAction(org.codelibs.fess.app.web.base.FessAdminAction) Map(java.util.Map) QueryHelper(org.codelibs.fess.helper.QueryHelper) RenderData(org.lastaflute.web.response.render.RenderData) HtmlResponse(org.lastaflute.web.response.HtmlResponse) SearchHelper(org.codelibs.fess.helper.SearchHelper) SearchRenderData(org.codelibs.fess.entity.SearchRenderData) QueryBuilders(org.opensearch.index.query.QueryBuilders) Secured(org.codelibs.fess.annotation.Secured) FessMessages(org.codelibs.fess.mylasta.action.FessMessages) OptionalEntity(org.dbflute.optional.OptionalEntity) Resource(javax.annotation.Resource) StringUtil(org.codelibs.core.lang.StringUtil) Consumer(java.util.function.Consumer) URLUtil(org.codelibs.core.net.URLUtil) List(java.util.List) Logger(org.apache.logging.log4j.Logger) QueryBuilder(org.opensearch.index.query.QueryBuilder) ComponentUtil(org.codelibs.fess.util.ComponentUtil) SystemHelper(org.codelibs.fess.helper.SystemHelper) Execute(org.lastaflute.web.Execute) VaMessenger(org.lastaflute.web.validation.VaMessenger) InvalidQueryException(org.codelibs.fess.exception.InvalidQueryException) LogManager(org.apache.logging.log4j.LogManager) QueryBuilder(org.opensearch.index.query.QueryBuilder) ResultOffsetExceededException(org.codelibs.fess.exception.ResultOffsetExceededException) InvalidQueryException(org.codelibs.fess.exception.InvalidQueryException) Execute(org.lastaflute.web.Execute) Secured(org.codelibs.fess.annotation.Secured)

Example 10 with QueryBuilder

use of org.opensearch.index.query.QueryBuilder in project fess by codelibs.

the class BsDataConfigCB method build.

// ===================================================================================
// Build
// =====
@Override
public SearchRequestBuilder build(SearchRequestBuilder builder) {
    if (_conditionQuery != null) {
        QueryBuilder queryBuilder = _conditionQuery.getQuery();
        if (queryBuilder != null) {
            builder.setQuery(queryBuilder);
        }
        _conditionQuery.getFieldSortBuilderList().forEach(sort -> {
            builder.addSort(sort);
        });
    }
    if (_conditionAggregation != null) {
        _conditionAggregation.getAggregationBuilderList().forEach(builder::addAggregation);
    }
    if (_specification != null) {
        builder.setFetchSource(_specification.columnList.toArray(new String[_specification.columnList.size()]), null);
    }
    return builder;
}
Also used : QueryBuilder(org.opensearch.index.query.QueryBuilder)

Aggregations

QueryBuilder (org.opensearch.index.query.QueryBuilder)47 FessConfig (org.codelibs.fess.mylasta.direction.FessConfig)11 SearchEngineClient (org.codelibs.fess.es.client.SearchEngineClient)6 BoolQueryBuilder (org.opensearch.index.query.BoolQueryBuilder)6 Map (java.util.Map)5 LogManager (org.apache.logging.log4j.LogManager)4 Logger (org.apache.logging.log4j.Logger)4 StringUtil (org.codelibs.core.lang.StringUtil)4 Constants (org.codelibs.fess.Constants)4 MatchPhraseQueryBuilder (org.opensearch.index.query.MatchPhraseQueryBuilder)4 PrefixQueryBuilder (org.opensearch.index.query.PrefixQueryBuilder)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Resource (javax.annotation.Resource)3 ComponentUtil (org.codelibs.fess.util.ComponentUtil)3 QueryBuilders (org.opensearch.index.query.QueryBuilders)3 HashMap (java.util.HashMap)2 Consumer (java.util.function.Consumer)2 PostConstruct (javax.annotation.PostConstruct)2 Tuple3 (org.codelibs.core.misc.Tuple3)2