[drupal-devel] [feature] Node module should provide node object to theme search hook

Anonymous drupal-devel at drupal.org
Sun Jan 23 21:55:43 UTC 2005

 Project:      Drupal
 Version:      4.5.0
 Component:    page.module
 Category:     feature requests
 Priority:     normal
 Assigned to:  Eric Scouten
 Reported by:  Eric Scouten
 Updated by:   Anonymous
 Status:       patch

I assume you want the $node object in theme('search_item').

Another possibility is to change nodeapi('search result') so it can add
custom fields to the $item array rather than just being for adding
textual information to the result by-line. That way, the image.module
could add a 'thumbnail' field, which can be displayed in the theme.

The problem really is: does presentation of the search result belong in
the theme or in the modules? I'd like to avoid putting features like
search thumbnails in a theme, as a thumbnail adds more information
rather than just changing the way something is presented.

The current search API is still a bit of a mess, mostly because I
focused on functionality of the content search, and just did a minor
cleanup of the API code in my patch. Perhaps more invasive changes are
needed to allow truly rich search results?


Previous comments:

January 23, 2005 - 20:28 : Eric Scouten

Attachment: http://drupal.org/files/issues/node_search_hook.patch (719 bytes)

As currently defined node.module's search hook doesn't provide enough
information to allow a rich rendering of search results. For instance,
in a photographic web site, I'd like the search results to show a
thumbnail of each matched image. I can't do this without access to the
node object.

The attached one-line patch provides access to the node object in the
search results.

View: http://drupal.org/node/16056
Edit: http://drupal.org/project/comments/add/16056

More information about the drupal-devel mailing list