fixes errors in search method, PLUS sorts posts by date

There were some errors in the search function migration. This edit should fix them.

posts are sorted in dates here, too. They still appear as html and are not yet rendering into the actual posts.