user input validation for search function