public static VisitorIterator createFromDocumentSelection(
            String documentSelection,
            BucketIdFactory idFactory,
            int distributionBitCount,
            ProgressToken progress,
            int slices,
            int sliceId) throws ParseException {
        BucketSelector bucketSel = new BucketSelector(idFactory);
        Set<BucketId> rawBuckets = bucketSel.getBucketList(documentSelection);
        BucketSource src;

        // Depending on whether the expression yielded an unknown number of
        // buckets, we create either an explicit bucket source or a distribution
        // bit-based range source
        if (rawBuckets == null) {
            // Range source
            src = new DistributionRangeBucketSource(distributionBitCount, progress, slices, sliceId);
        } else {
            // Explicit source
            src = new ExplicitBucketSource(rawBuckets, distributionBitCount, progress);
        }

        return new VisitorIterator(progress, src);
    }
Create a new <code>VisitorIterator</code> instance based on the given document
selection string.

@param documentSelection Document selection string used to create the
<code>VisitorIterator</code> instance. Depending on the characteristics of the
selection, the iterator may iterate over only a small subset of the buckets or
every bucket in the system. Both cases will be handled efficiently.
@param idFactory {@link BucketId} factory specifying the number of distribution bits
to use et al.
@param progress A unique {@link ProgressToken} instance which is used for maintaining the state
of the iterator. Can <em>not</em> be shared with other iterator instances at the same time.
If <code>progress</code> contains work done in an earlier iteration run, the iterator will pick
up from where it left off
@return A new <code>VisitorIterator</code> instance
@throws ParseException if <code>documentSelection</code> fails to properly parse
documentapi/src/main/java/com/yahoo/documentapi/VisitorIterator.java