inverted index code