Expose scrolling operations through JPA/ORM queries

Description

  1. Implement scroll() and scroll(ScrollMode) in HibernateOrmSearchQueryAdapter, relying on SearchQuery#scroll(int) under the scene.

    1. Only ScrollMode.FORWARD_ONLY will be supported.

    2. We will need to decide on a page size. Let's use the same size as the loading fetch size, which should be accessible from org.hibernate.search.mapper.orm.search.loading.impl.MutableEntityLoadingOptions#getFetchSize.

    3. Some internal windowing will probably be necessary. Just copy/paste the org.hibernate.search.elasticsearch.util.impl.Window class from Search 5 and adapt it. Do not forget to also copy the unit test, org.hibernate.search.elasticsearch.test.WindowTest.

    4. See org.hibernate.search.query.hibernate.impl.ScrollableResultsImpl for an example of how it was done in Search 5 (may or may not be helpful).

  2. Add tests for scroll() and scroll(ScrollMode) in org.hibernate.search.integrationtest.mapper.orm.hibernateormapis.ToHibernateOrmIT:

    1. Nominal case (create scroll, fetch some hits until all hits have been consumed, close).

    2. Edge cases: not fetching any result (should work fine), fetching some results but not all of them (should work fine), trying to fetch more than the total hit count (should throw an exception).

    3. Error cases: trying to scroll back, trying to call the get*(int) methods...

    4. Check that using any scroll mode other than ScrollMode.FORWARD_ONLY fails.

    5. Test query.stream() too (it's based on scroll()).

  3. Add tests for getResultStream() in org.hibernate.search.integrationtest.mapper.orm.hibernateormapis.ToJpaIT.

Activity

Show:
Fixed

Details

Assignee

Reporter

Components

Sprint

Fix versions

Priority

Created July 30, 2020 at 4:04 PM
Updated September 4, 2020 at 1:07 PM
Resolved August 17, 2020 at 11:06 AM