use of org.codelibs.fess.app.web.api.ApiResult.ApiDocsResponse in project fess by codelibs.
the class ApiAdminSearchlistAction method docs.
// ===================================================================================
// Search Execute
// ==============
// GET /api/admin/searchlist
// POST /api/admin/searchlist
@Execute
public JsonResponse<ApiResult> docs(final SearchBody body) {
validateApi(body, messages -> {
});
if (StringUtil.isBlank(body.q)) {
// query matches on all documents.
body.q = Constants.MATCHES_ALL_QUERY;
}
final SearchRenderData renderData = new SearchRenderData();
body.initialize();
try {
searchService.search(body, renderData, getUserBean());
return asJson(new ApiDocsResponse().renderData(renderData).status(Status.OK).result());
} catch (final InvalidQueryException e) {
if (logger.isDebugEnabled()) {
logger.debug(e.getMessage(), e);
}
throwValidationErrorApi(e.getMessageCode());
} catch (final ResultOffsetExceededException e) {
if (logger.isDebugEnabled()) {
logger.debug(e.getMessage(), e);
}
throwValidationErrorApi(messages -> messages.addErrorsResultSizeExceeded(GLOBAL));
}
throwValidationErrorApi(messages -> messages.addErrorsInvalidQueryUnknown(GLOBAL));
// ignore
return null;
}
Aggregations