Generalize estimator code to also work with expressional indexes

Improves raster selectivity estimator (#2839)