class TipsAndTricksServiceImpl implements TipsAndTricksService {

    @Override
    public PageableDto<SearchTipsAndTricksDto> search(String searchQuery) {
        Page<TipsAndTricks> page = tipsAndTricksRepo.searchTipsAndTricks(PageRequest.of(0, 3), searchQuery);

        List<SearchTipsAndTricksDto> tipsAndTricksDtos = page.stream()
            .map(tipsAndTricks -> modelMapper.map(tipsAndTricks, SearchTipsAndTricksDto.class))
            .collect(Collectors.toList());

        return new PageableDto<>(
            tipsAndTricksDtos,
            page.getTotalElements(),
            page.getPageable().getPageNumber(),
            page.getTotalPages()
        );
    }

}