Page MenuHomePhabricator

Redirects in search not properly handled
Closed, ResolvedPublic

Description

First off, I noticed this on commons under MW 1.14 already, but now I have 1.16 installed with the new search so it's clear.

I was talking to rainman-sr and he said it depends on the search backend. Nontheless, under the "Advanced" section there is the checkbox "List redirects" (ticked by default) which is hidden on wp etc atm for some reason (maybe simply for not confusing the users with that non working feature).

Bug #1) When you untick it, the result page loads with it ticked again.

Bug #2) Redirs=1 or redirs=0 makes no difference.
[[User:Subfader/rpl]] is a redirect to [[User:Subfader/rpl moved]].
http://www.mediawiki.org/w/index.php?title=Special%3ASearch&search=rpl&fulltext=Search&ns2=1&redirs=1
http://www.mediawiki.org/w/index.php?title=Special%3ASearch&search=rpl&fulltext=Search&ns2=1&redirs=0

Example from my wiki, original created URL:
http://www.mixesdb.com/db/index.php?title=Special%3ASearch&redirs=1&search=TestX&fulltext=Search&ns2=1&redirs=0&title=Special%3ASearch&advanced=1&fulltext=Advanced+search&type=all&q=&btn=search
a) Note that the redirs parameter is set twice.
b) Try to not list the redirect: http://www.mixesdb.com/db/index.php?title=Special%3ASearch&search=TestX&fulltext=Search&ns2=1&redirs=0


Version: 1.16.x
Severity: normal

Details

Reference
bz19662

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:39 PM
bzimport added a project: MediaWiki-Search.
bzimport set Reference to bz19662.

Yeah, this looks like a big ol' bug in the Special:Search frontend; the checkbox just doesn't take when you untick it under Advanced.

Trevor, can you take a peek? Thanks!

svemir wrote:

This was caused by this line in SpecialSearch::shortDialog prior to MW 1.18

$out .= Html::hidden( "redirs", (int)$this->searchRedirects ) . "\n";

The flow was apparently changed a bit in 1.18, and "redirs" option is skipped when generating hidden fields.

It works fine for me in 1.17 if I comment out the offending line. There is no need to render the hidden field when checkbox is there.