The date Drupal shows on search results is not the date the node was created. Instead it is the date the node was indexed by the search indexer.
Most of the time this is the wanted behavior. Your nodes get indexed when cron is run and if you run cron each 5 or 15 minutes this date is within 15 minutes of the creation date.
But the date is far off when import your nodes from another system. Sometimes this date has been created years ago, and then the time between creation and indexing is long.
As always there's an easy fix for this in Drupal. The search results are themed via theme_search_item and we all know how to override a theme function.
We just have to change
if ($item['date']) {
$info[] = format_date($item['date'], 'small');
}
to
if(isset($item['node'])) {
$info[] = format_date($item['node']->created, 'small');
} elseif ($item['date']) {
$info[] = format_date($item['date'], 'small');
}
So we get:
function phptemplate_search_item($item, $type) {
$output = ' <h3><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></h3>';
$info = array();
if ($item['type']) {
$info[] = check_plain($item['type']);
}
if ($item['user']) {
$info[] = $item['user'];
}
/*if ($item['date']) {
$info[] = format_date($item['date'], 'small');
}*/
if(isset($item['node'])) {
$info[] = format_date($item['node']->created, 'small');
} elseif ($item['date']) {
$info[] = format_date($item['date'], 'small');
}
if (is_array($item['extra'])) {
$info = array_merge($info, $item['extra']);
}
$output .= ' <div>'. ($item['snippet'] ? '<p>'. $item['snippet'] .'</p>' : '') .'<p class="search-info">'. implode(' - ', $info) .'</p></div>';
return $output;
}