autocomplete controller function