Add function to search view