option to return indices instead of counts