Appreciate the responses... >> Try >> SELECT ...., (((keywords LIKE '%$search%') * 5) + ((title LIKE >> '%$search%') * 3) + (description LIKE '%$search%')) score FROM ..... >> ORDER BY score DESC > >PostgreSQL cannot type cast the Boolean type so you have to use a case >statement, also changing like to ilike will get results regardless of >case. > >SELECT ...., ((CASE WHEN (keywords ILIKE '%$search%') THEN 5 ELSE 0 END) + >(CASE WHEN (title ILIKE '%$search%') THEN 3 ELSE 0 END) + (CASE WHEN >(description ILIKE '%$search%') THEN 1 ELSE 0 END)) AS score FROM .... >ORDER BY score DESC
We are talking a db of under 10k records where the search would take place on. what are the ramifications of this as a load on the postgres server? Wouldn't want to have a great search query that grinds the server to a halt everytime someone searches regardless of the accuracy of the end result :) Thanks Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php