Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-28334

Create a scroll service

    XMLWordPrintable

    Details

    • 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

      Description

      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();
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 days
                  3d