The easiest way to do searches is to build a big ugly sql query in php code and throw it at postgresql.
One of the nice things about postgresql is that it can handle truly huge, ugly sql queries pretty efficiently.
For a single search term, and one field in the database to search, you just need to build a query like so:
$term = addslashes($term);
$query = "select * from table where field like '%$term%'"
But what about multiple fields to be searched? Do it like this:
$term = "1234";
$table = "p1";
$term = addslashes($term);
$fields = array("name","enum");
$query = "select * from ".$table." where ";
for ($i=0;$i<count($fields);$i++){
if ($i>0) $query .= "or ";
$query .= $fields[$i]." like '%".$term."%' ";
}
print $query;
Now you need to write a loop inside to add the ability to search for more than one term, and you're there.