In an extension, I'd like to detect when the "Go" button has been used to
jump directly to an article that exists. Any ideas how to do this? Here is what I have
tried so far:
- The Special:Search page (file specials/SpecialSearch.php) does an immediate
redirect to the target, with no hook provided.
- There is a hook SpecialSearchNogomatch that detects the use of the "Go"
button but only when the target doesn't exist. That's the opposite of what I
need: in my case, the target does exist. This hook is called too late anyway (after the
redirect).
- The hooks SpecialSearchResults and SpecialSearchNoResults do not fire in this
situation
- Maybe use a hook in the Title or Article class, but how to detect only the Go
button? I don't want to include articles that have been visited by URL or by clicking
a wiki link.
By brute force, I could probably make my extension run on every page load (ugh), tracking
if I'm on Special:Search with a query string parameter "Go=go", and then use
the SpecialSearchNogomatch hook to exclude searches that fail. But that feels like an
inefficient hack.
Thanks for any ideas....
DanB