fix sparse getindex regression

This PR aims to fix broken `getindex` for sparse matrices with index type other than `Int` and adds some related tests.
ref #7131, #7047

I reused `r1` to be the result of `searchsortedfirst`