Hello,

Just three quick questions on Drupal 5, related to the Search module.

1) Is there a way to make it search in the middle of words ?

Say i have a node titled "ARMADILLO RHYNOCERUS" and i want to find it by searching for "dillo" . Currently this search will yield no results. How can i change this?

2) I have disabled "post information" (submitted by) on all content types. But on the search results page, that piece of info still appears along with the date of submission. I want to hide this, but how?

3) What is the best search module to replace the official one? I dont need too much fancy stuff, just something that builds on the original concept and adds a little bit more useful features.

Comments

francort’s picture

1) No
2) They are 2 different things: one is the configuration for the theme and the other is part of a module. That's why that behavior, because the theme is not overriding what the module is trying to print( maybe too technichal )
Copy this code into your template.php file:

function phptemplate_search_item($item, $type) {
  $output = ' <dt class="title"><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></dt>';
  $info = array();
  if ($item['type']) {
    $info[] = check_plain($item['type']);
  }
  if ($item['user']) {
    $info[] = $item['user'];
  }
  /*if ($item['date']) {
    $info[] = format_date($item['date'], 'small');
  }*/
  if (is_array($item['extra'])) {
    $info = array_merge($info, $item['extra']);
  }
  $output .= ' <dd>'. ($item['snippet'] ? '<p>'. $item['snippet'] .'</p>' : '') .'<p class="search-info">'. implode(' - ', $info) .'</p></dd>';
  return $output;

This way the Theme will override the content made by search module. I have commented the part where the date was added. You can play with this code to see different results.

3) Take a look to this one http://drupal.org/project/google_cse

I hope this would help

doomed’s picture

Thanks for your response! :)

The code part will definitely help.

I'm also looking at this http://drupal.org/node/175013

I'm not playing Drupal tonight because it's so late already.. but will post my results later.

doomed’s picture

That piece of code worked well (you just forgot a closing } in the end, no biggie :p ). I took out username too, because i dont want that.
Thanks, again.