create a class to implement index and search