Added api for getting the number of items in an index after or before an offset