use of com.icthh.xm.ms.entity.service.dto.SearchDto in project xm-ms-entity by xm-online.
the class XmEntityResource method searchXmEntitiesV2.
@GetMapping("/_search/v2/xm-entities")
@Timed
@PreAuthorize("hasPermission({'query': #query}, 'XMENTITY.SEARCH.QUERY')")
@PrivilegeDescription("Privilege to search for the xmEntity corresponding to the query")
public ResponseEntity<List<XmEntity>> searchXmEntitiesV2(@RequestParam String query, @ApiParam Pageable pageable, @ApiParam ElasticFetchSourceFilterDto fetchSourceFilterDto) {
SearchDto searchDto = SearchDto.builder().query(query).pageable(pageable).entityClass(XmEntity.class).fetchSourceFilter(new FetchSourceFilter(fetchSourceFilterDto.getIncludes(), fetchSourceFilterDto.getExcludes())).build();
Page<XmEntity> page = xmEntityService.searchV2(searchDto, null);
HttpHeaders headers = PaginationUtil.generateSearchPaginationHttpHeaders(query, page, "/api/_search/xm-entities");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
Aggregations