The proposed patch adds to search the ability to generate a block listing the most recent searches performed on the site.

Note that using this block can have unexpected effects on search engine results: the terms recently searched can be picked up by the robots and searched again, artificially inflating their frequency.

Comments

fgm’s picture

StatusFileSize
new2.16 KB

Changed to include -up option to diff.

boris mann’s picture

Version: 4.6.3 » x.y.z

This is a great little feature. Of course, my future wishlist is for saved searches with RSS output -- e.g. search/node/[search terms]/feed

Re: the search engine comment -- the statistics block/popular content already does this. It's an interesting FYI, but just kind of the way it is. Theoretically, wrapping it in "nofollow" might change this, but I don't think it's a concern.

Also, setting to CVS -- new features only get applied to new versions, so ideally a 4.7 patch will be provided as well (I'll look into this).

fgm’s picture

I pondered this and came up with an idea for a better implementation of this feature, which brings along other advantages for module developers.

However, it involves changes to core tables and a new hook, so I've put up a wiki page to discuss it before code gets written: http://wiki.audean.com/doku.php?id=dr:zeitgeist

Feel free to comment here, or edit on the wiki: I think these changes would be for the better, but the consequences must be considered.

fgm’s picture

StatusFileSize
new7.5 KB

The new version of the patch

- incorporates a database change to watchdog as discussed at the previous comment: a NULL-able "data" column is added to the watchdog table for raw logging
- is more resilient as it no longers relies on the formatting in the watchdog tables, so it should be i18n-compatible
- works both node and user search, and should work on other search types as well

sillygwailo’s picture

StatusFileSize
new1.66 KB

Attached is a patch based on fgm's, but patching the 4.7 beta 2 version of the search module.

My patch also cleans up the whitespace, changes some variable names to be more descriptive, and adds rel="nofollow" to the links (to prevent search engines from archiving searches, throwing off the recent searches block entirely).

dries’s picture

I guess this would be a handy block to display on the sidebar of the search page. I think Richard's code needs a bit of work though. It seems to assume that people want 5 results only, and that all searches are 'node'-searches. I leave it up to someone else to provide a more in depth review.

Steven’s picture

The patch also breaks on non-english installs. Scraping the watchdog table is just plain ugly.

We also need to consider the performance impact of a DISTINCT query on a possibly large table.

fgm’s picture

Steven "Scraping the watchdog table is just plain ugly". That's precisely why I made the suggestion described in my followup dated 30/11/05 09:23.

The i18n issue is described on the discussion page I mentioned in that followup. Note that Richard's patch is based on my initial quick hack, not on the better version discussed in the followup and the wiki.

fgm’s picture

Assigned: Unassigned » fgm
Status: Needs review » Fixed

I dropped the patch idea entirely and rebuilt the feature more cleanly, as a standalone module:
http://drupal.org/node/50188

markus_petrux’s picture

Zeitgeist? What does it mean?

Sorry for my ignorance. Though, I believe if the module was named "Recent searches" or something similar it would reach more people.

fgm’s picture

A basic answer:
http://en.wikipedia.org/wiki/Zeitgeist

And possibly the world's most famous zeitgeist page:
http://www.google.com/press/zeitgeist.html

Indeed, in the module itself, the block is called "recent searches".

markus_petrux’s picture

Thanks a lot! Very interesting, really. :-)

Anonymous’s picture

Status: Fixed » Closed (fixed)