Commit fix logic for search function