Custom search results page query, link permalink to post title while separating by post types

I am using Option 3 from this answer as my source. So far it is working great, it is splitting my search results by post type and listing the posts from each post type in their own sections. The only problem is that this solution does not appear to allow for hyperlinking the post titles using the_permalink(); How can I adapt this code so that I can also wrap the post titles in an anchor tag that will direct to the post?