generalize indexin definition

As discussed in #7085