select function for tags and search return