class GoogleStorageSearchFeature implements Search {

    @Override
    public AttributedList<Path> search(final Path workdir, final Filter<Path> regex, final ListProgressListener listener) throws BackgroundException {
        final AttributedList<Path> objects;
        try {
            objects = new GoogleStorageObjectListService(session).list(workdir, listener, null,
                PreferencesFactory.get().getInteger("googlestorage.listing.chunksize"));
        }
        catch(NotfoundException e) {
            return AttributedList.emptyList();
        }
        final Set<Path> removal = new HashSet<>();
        for(final Path f : objects) {
            if(!f.getName().contains(regex.toPattern().pattern())) {
                removal.add(f);
            }
        }
        objects.removeAll(removal);
        return objects;
    }

    public  GoogleStorageSearchFeature(final GoogleStorageSession session);

}