[BACKPORT] Avoid potentially expensive `len()` call in value index estimation.

backport:

https://github.com/zopefoundation/Products.ZCatalog/commit/3770bc998a2656ecdcfc494d5996e6a89fbc2365

Avoid potentially expensive `len()` call in value index estimation.

Instead iterate over unique values and break if we can get more than
`MAX_DISTINCT_VALUES` values. Also correctly identify empty indexes like the
DateRangeIndex, which only returns values when the name argument is provided
to the uniqueValues method with either the `since` or `until` field.