I have the following code:
$collection = Mage::getSingleton('catalogsearch/layer')->getProductCollection();
I've tried
$collection = Mage::getSingleton('catalogsearch/layer')->getProductCollection()->addAttributeToSort('relevance', 'desc')
But it does not work.
Any ideas?
Check out this related answer: Magento Search 'relevance' Value is Always 0
It gives some insight into the relevance value of search results.