Backend-specific extensions for scroll

Description

See item 12 in HSEARCH-3323:

Allow backends to extend the SearchScroll interfaces, like they currently do with SearchQuery (ElasticsearchSearchQuery, LuceneSearchQuery):

  1. Add a generic parameter S extends SearchScroll<H> to ExtendedSearchFetchable and override its scroll methods to return that type.

  2. Adapt the interfaces that extend ExtendedSearchFetchable as necessary.

  3. Create a new ExtendedSearchScroll<H> interface using the same principle.

  4. Create specific interfaces for Elasticsearch and Lucene: ElasticsearchSearchScroll and LuceneSearchScroll.

  5. Implement these interfaces where appropriate.

  6. Test extensions for Lucene and Elasticsearch. Mainly, check that the scroll has the correct type. See how it's done for SearchResult in org.hibernate.search.integrationtest.backend.elasticsearch.ElasticsearchExtensionIT#query.

Optionally, we may also handle item 8, but let's discuss it together on Zulip first:

Add Lucene-specific extensions to Scrolling

  1. This is mainly necessary for Infinispan

  2. Expose a way to force Lucene to extract TopDocs up to a specific index and retrieve them: LuceneSearchScroll#preloadTopDocsUpTo(), returns TopDocs

  3. Expose a way to load a specific document specified by its index: LuceneSearchScroll#loadHitByIndex(), returns H

  4. Maybe we can improve on that later; ideally Infinispan should load multiple hits in one call (LuceneSearchScroll#loadHitsByIndex(int ...), returns List<H>) otherwise the cost of creating collectors for each retrieved hit will be a bit too much.

Environment

None

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Fix versions

Priority

Major
Configure