Adapt the function to handle multiple occurrences of the query item by returning the index of the first occurrence.