As of 4.7.x/7.x, Drupal does not implement a standard search logging API. The net result is that code like zeitgeist.module, which needs to record data from core, must obtain them from undocumented behaviours.
The core patch from which this module has been born used to parse the standard “watchdog” table from the dblog module.
For zeitgeist.module 4.7.x-1.1 to 4.7.x-1.6, this meant parsing both the “search form” form and search
URL, which led to various problems, notably regarding potential safety issues, and the algorithm proved unreliable over minor core releases changing search.module.
Later versions only alter search forms to add a submit handler. This simplifies the code, but leave it vulnerable to search.module changes.
At some point, drupal core will probably evolve to include such a logging mechanism, and zeitgeist will then be able to use it. Should the module become popular, it is also conceivable that search.module add a recording hook, independent of other recording needs. Things have evolved for the better in Drupal 7, where a single form implementation is used for all search forms, allowing simpler and more generic logging from the form submit handler.
Until this happens, it could be possible to use runki_function_rename to:
rename drupal's do_search function to something like zeitgeist_do_search,
implement a local do_search() function in zeitgeist.module. At this point calls by other modules should go to the new function instead of the standard version
within this local do_search,
perform the _zeitgeist_store_search
invoke the standard do_search, now called zeitgeist_do_search
return the results obtained from the standard do_search from our custom do_search
Problems:
This would fail if the standard do_search did some stack checking, but the current version doesn't.
This requires the experimental “runkit” PECL package, absent from most PHP installations, and apparently unstable