Pagination in hibernate search

Hi all,

Currently, to achieve pagination of hibernate search, I use setFirstResult() and setMaxResults() for pagenumber and pagesize, which runs good.

But now, there is an advice to leverage what’s available in Spring boot by using org.springframework.data.domain.Pageable.

I am wondering if this does work? or how to integrate into hibernate search?

There is an external project aiming at providing read-only Spring Data integration of Hibernate Search here: https://github.com/snowdrop/spring-data-snowdrop . It will allow you to write simple queries which will be derived automatically from the name of the repository method, and I think it supports this Pageable thing.

For more advanced use cases, I think you can always write your own queries by implementing the repository methods, and I think you don’t even need snowdrop for that. But I’m no expert: you will get more useful answers from the Spring Data mailing lists or forums.