refactor search to api module