Search api refactoring