Fremantle
· Wikimedia · MediaWiki · searching · InputBox ·
Thanks to a recent wish I've been poking a bit at the InputBox extension lately, to make it work better with MediaSearch and CirrusSearch. This involves making it honour the user preference for Special:Search or Special:MediaSearch (if the extension for the latter is installed), and fixing up the way in which it passes its searchfilter parameter to the search page.
The fix for the first issue was to set the initial form action (which ends up in the parser cache and so can't be user-specific) to the site's default, and then have a front-end switch that dynamically changes it to whatever the current user has as their preference. Slightly clunkily, this involves sending both possible URLs to the front end and then choosing between them, because otherwise they wouldn't be localised.
The second issue came about because InputBox submits search and searchfilter values as separate GET parameters, and then on loading the special page it would changes the internal request object to have a unified value (i.e. these two values concatenated with a space between them). The trouble with that was that you'd end up at a URL like Special:Search?search=foo&searchfilter=insource:Bar and so anything that was accessing the search value directly would get it wrong. So the fix was to unify the values and then redirect to a new URL without searchfilter, and also to skip that redirect by doing the same sort of replacement in the front-end. So most people will not get the redirect, but we always aim to have a no-JS fallback. I did wonder about switching the input names around so that there's no visible change to the text input, which might be confusing to people who see it change but only after they've clicked submit and so there's no time to notice what it's doing.
I think there are similar improvements that could be made to other parts of InputBox, such as type=move with a prefix, but no one's complained about that not working so I don't think I'll bother digging any further for now.
My main RSS news feed: https://samwilson.id.au/news.rss
(or Wikimedia.rss, Fremantle.rss, OpenStreetMap.rss, etc. for topic feeds).
Email me at sam or leave a comment below…
samwilson.id.au