print "<br />after search row as: ".date('l dS \of F Y h:i:s A');
if (count($contact_ids) > 0) { // only keep on truckin' if we actually got results.
$results = _civicrm_db_query('SELECT id, sort_name FROM civicrm_contact WHERE id IN ( '.implode(', ', $contact_ids).' )');
print "<br />after name query : ".date('l dS \of F Y h:i:s A');
while ($result = db_fetch_object($results)) { // now, with all our filtered IDs, attempt to make a final dataset.
$rows[$result->id]['name'] = $result->sort_name; // this one for sorting by our magical array helper. hoo-hah.
$rows[$result->id]['vname'] = l($result->sort_name, 'civicrm/contact/view', NULL, 'reset=1&cid='.$result->id);
} $rows = civicrm_search_map_addresses($contact_ids, $rows);
print "<br />after address query: ".date('l dS \of F Y h:i:s A');