Handle pg search ordering bug for cookbooks search

:fork_and_knife: There appears to be an issue with the pg search gem https://github.com/Casecommons/pg_search/issues/129 that breaks ordering after a search has been performed. This changes the controller flow so ordering is done before searching and also adds a spec originally used to reproduce the bug but seems handy to keep around in case pg search misbehaves again.