[Refactor Ticket] move search code