-
Type: Improvement
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 10.10-HF21, 11.1, 2021.0
-
Component/s: Core
-
Backlog priority:750
-
Team:PLATFORM
-
Sprint:nxplatform 11.1.23, nxplatform 11.1.25, nxplatform 11.1.24, nxplatform 11.1.26
-
Story Points:2
We need a service to retrieve a long list of identifiers representing a result set.
There are already scroll API in the repository to list document ids:
- nuxeo-core-api CoreSession
- ScrollResult<String> scroll(String query, int batchSize, int keepAliveSeconds);
- ScrollResult<String> scroll(String scrollId);
And in elasticsearch
- nuxeo-features/nuxeo-elasticsearch ElasticSearchServiceImpl
- EsScrollResult scroll(NxQueryBuilder queryBuilder, long keepAlive)
- EsScrollResult scroll(EsScrollResult scrollResult)
This could be 2 contributions of a scroll service, so the client doesn't have to use different API.
Also, It could be interesting to have other document scrollers:
- a list of ids (so we don't have to query the repository or elastic)
- a file in transient store containing a list of ids
Or to scroll on non-documents identifier:
- audit entry ids
- user ids
- dictionary ids
- a stream
A possible client usage can be:
ScrollRequest request = DocumentScrollRequest.builder("Select * from Document").scroll("elastic").size(10).username("bob").build(); try (Scroll scroll = service.scroll(request)) { while (scroller.fetch()) { List<String> ids = scroller.getIds(); // ... } } // Same request but using the repository search: ScrollRequest request = DocumentScrollRequest.builder("Select * from Document").scroll("repository").size(10).build(); // Static identifier list ScrollRequest request = StaticScrollRequest.builder("docid1,docid2").size(10).build(); // A file containing a list of ids Scroller<String> fileScroller = FileScrollRequest.builder("path/to/id-list.txt").build(); // Querying the audit Scroller<String> auditScroller = AuditScrollRequest.builder("entryId > 1234").size(10).build(); Scroller<String> auditScroller = AuditScrollRequest.builder("entryDate > now - 1d").size(10).build();