I apologize if I am missing a big documentation page out there, but I have searched all over drupal.org without finding a solution to my problem. I am looking to custom SORT my search results of a particular cck type based on a particular cck field. To give an example:

I have a 'program' content type for tv programs. All of those programs have a production date associated with them. So when my search results return programs, I want them to sort based on production date descending.

So far, I am using phptemplate_search_item to formulate my search results and display the fields I want, and I found really great documentation on that. But I don't think I can do sorting in phptemplate_search_item since that's only by the item. I am thinking I might be able to do it with theme_search_page. All I added in was what I thought might work for a sorting function. Regular sort and rsort work, but I just can't figure out how to sort by the field I want in descending order. Here is what I've been trying:

<?php 
function scheduler_search_page($results, $type) {
  $output = '<dl class="search-results">';
  
  if ($type == 'content_program'){
    sort($results, $node->field_pdate[0]['value']);
  }

  foreach ($results as $entry) {
    $output .= theme('search_item', $entry, $type);
  }
  $output .= '</dl>';
  $output .= theme('pager', NULL, 10, 0);

  return $output;
} ?>

Any help or pointers to doc pages that I missed would be greatly appreciated!