refactoring ivfpq search method