logic to search type working