sql
Filtering Search Results On CCK Fields
Submitted by greg.harvey on Wed, 03/06/2009 - 14:01This is a quick HOWTO on altering the core Search module's database query in Drupal 5.x and 6.x. I think this will be different in 7.x, as there seem to be new, better hooks for manipulating queries, but we're not there yet.
For now, the hook you need is hook_db_rewrite_sql(). This allows you to add JOINs and WHERE clauses to existing SQL queries being generated by other Drupal modules.

