class DropboxSearchFeature implements Search {

    @Override
    public AttributedList<Path> search(final Path workdir, final Filter<Path> regex, final ListProgressListener listener) throws BackgroundException {
        try {
            final AttributedList<Path> list = new AttributedList<>();
            long start = 0;
            SearchV2Result result = new DbxUserFilesRequests(session.getClient(workdir)).searchV2Builder(regex.toPattern().pattern())
                .withOptions(SearchOptions.newBuilder().withPath(containerService.getKey(workdir)).build()).start();
            this.parse(workdir, listener, list, result);
            while(result.getHasMore()) {
                this.parse(workdir, listener, list, result = new DbxUserFilesRequests(session.getClient(workdir)).searchContinueV2(result.getCursor()));
                if(this.parse(workdir, listener, list, result)) {
                    return null;
                }
            }
            return list;
        }
        catch(DbxException e) {
            throw new DropboxExceptionMappingService().map("Failure to read attributes of {0}", e, workdir);
        }
    }

    public  DropboxSearchFeature(final DropboxSession session);

}