Create your Own Search

How would you go about creating your own search for WordPress or replacing the built in search for WordPress? I want to list items from a separate table.

So far I'm able to get the list of items, BUT it wants the url to be a post.

What I have so far:

add_action( 'wp', customsearch' );

function customsearch( $pag )
{
return;
global $wp_query, $wpdb;
if ( $wp_query->is_search )
{

$key = $wp_query->query_vars['s'];
$wpdb->query( 'SELECT id,name FROM ' .PRODUCT_LIST . ' WHERE name LIKE "%' . $wpdb->escape($key) .
'%"' );
$list = $wpdb->last_result;
$ids = array();
$names = array();

foreach ( $list as $item )
{

$ids[] = $item->id;

$names[] = $item->name;

}
$wp_query->post_count = count( $list );
foreach ( $list as $k => $post )
{

if ( isset($names[$k]) && $names[$k] != '' )
$post->post_title = $names[$k];

$wp_query->posts[] = $post;

}

}

}

This code returns a list of items, but I have no way of specifying the URL, or anything. I had thought about trying to intercept the search page content using the_content filter, but this does not seem to work, or atleast how I tried to do it.

Any help would be appreciated.

-Brad