How to get the count of items generated by the query. Suppose let the query generates 12 items.
product.size() -> generates " 12 ";
But since I am paging it by 4 items per page, when I do
product.size() -> generates " 4 ";
My question is how to get the total count as 12 and not 4 with respect to the page.
Service
public SearchPage productSearch(String query {
Pageable pageable=PageRequest.of(0,4);
List<Products> products=repository.getProductByQuery(query,pageable);
}
Repository
@Query("select DISTINCT p1 from Products p1 where CONCAT(p1.title,p1.category) like %:query%")
List<Products> getProductByQuery(@Param("query") String query, Pageable pageable);