- 2009-11-29: mongodb_watchdog module created by dereine, ported to D7 by me in about half an hour, and migrated in a larger MongoDB project by damz before the hour ended. Wow...
- 2009-07-13: 100% unit test coverage on Taxonews for both D6 and D7 versions
- 2009-02-03: the new Drupal-based site for the golden jubilee of the french "Ministère de la Culture", which OSInet helped build, is now online
- 2009-01-22: new API site for CCK à la api.drupal.org
Drupal tips: showing recent searches
Some sites include a list of terms recently searched for. I've created a patch for Drupal adding this functionality to the current 4.6.x search module.
Felt well awake this morning so, as I hadn't coded anything on the helpdesk module for a while, I thought I'd scratch some personal Drupal itch and add this feature: now any Drupal site can have a "recent searches" block.
This is currently available as a patch for 4.6.3, but should be readily adaptable to the current HEAD.
If you look at the code, it looks rather fragile,
because search.module in Drupal 4.6 does not cleanly log
queries, but logs them preformatted using the
watchdog
function as readily usable links, so some formatting is in order.
After coding it, some improvement ideas spring to mind, if anyone is interested:
- Allow more than one block to be defined, to show either searches on nodes (as currently) or on users (but who would really want this to show ?)
- Define the length of the list in a setting, instead of the fixed 5 values list in this first version.
- Show the result count next to the search. This one would be heavy server-side, as it would involve performing the searches for just that display, or modifying search more heavily to log the result count along with the query link.
- Display safety: this has not been checked in this version. If search does not protect against injection attacks, this first version will probably be affected.
- This should be adapted for HEAD/4.7, unless it already includes a similar feature. As I'm not currently not giving HEAD a try because of the expected unstabilities, I don't know if such a block has been added.





This patch has now blossomed into the Zeitgeist module
Following the discussion on drupal.org regarding the fragility of this suggested patch, I rethought the question entirely, and came up with a module dedicated to logging recent searches.
That module is called Zeitgeist, and can be downloaded from http://drupal.org/node/50188.
Drupal 6?
How do we do this for D6 ?
Zeitgeist exists for D6
Since Zeitgeist exists for D6, why not just use it ?