better handling of search type