an easy method to implement search function