Drupal

Make Drupal search generic

Problem

Drupal doesn't manage wild card searches like

ex : "compan*" for "companies" or "company"

Solution

in includes/database.mysql.inc or includes/database.mysqli.inc depending of the db driver used

function _db_query($query, $debug = 0) {
global $active_db, $queries, $user;
if (strpos($query,"node_search_index.word"))
      $query=preg_replace("/node_search_index.word = '([^']*)'/",
             "node_search_index.word like '%$1%'",$query)
Syndiquer le contenu