add functions to query indices

added idxrange, idxrevrange and idxlen