start to re-implement the knn search algo