| See item 12 in HSEARCH-3323:
Allow backends to extend the SearchScroll interfaces, like they currently do with SearchQuery (ElasticsearchSearchQuery, LuceneSearchQuery):
- Add a generic parameter S extends SearchScroll<H> to ExtendedSearchFetchable and override its scroll methods to return that type.
- Adapt the interfaces that extend ExtendedSearchFetchable as necessary.
- Create a new ExtendedSearchScroll<H> interface using the same principle.
- Create specific interfaces for Elasticsearch and Lucene: ElasticsearchSearchScroll and LuceneSearchScroll.
- Implement these interfaces where appropriate.
- 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
- This is mainly necessary for Infinispan
- Expose a way to force Lucene to extract TopDocs up to a specific index and retrieve them: LuceneSearchScroll#preloadTopDocsUpTo(), returns TopDocs
- Expose a way to load a specific document specified by its index: LuceneSearchScroll#loadHitByIndex(), returns H
- 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.
|