Page MenuHomePhabricator

Search for (Firefox smart keyword) %s opens Main Page
Closed, DeclinedPublic

Description

patch for includes/specials/SpecialSearch.php

In Mozilla Firefox you can create a "smart keyword" when you make a right-click to search field and select "Add a Keyword for this Search...". Then you can create a new bookmark with an keyword.

https://support.mozilla.org/en-US/kb/how-search-from-address-bar

When you do this for enwiki you create a bookmark to the URL

https://en.wikipedia.org/w/index.php?search=%s&title=Special%3ASearch

With the keyword "wp" you can enter "wp foo" then the "%s" gets substituted by "foo" and the URL https://en.wikipedia.org/w/index.php?search=foo&title=Special%3ASearch gets loaded. The search redirects (302) to https://en.wikipedia.org/wiki/Foo and shows the article [[Foobar]] because [[Foo]] is a redirect to [[Foobar]].

When you open the keyword without an search string "wp" the Firefox opens the URL https://en.wikipedia.org/w/index.php?search=&title=Special%3ASearch which is a empty search page.

But when you open this bookmark as normal bookmark then the Firefox opens the URL https://en.wikipedia.org/w/index.php?search=%s&title=Special%3ASearch and opens the article [[%s]]. When [[%s]] doesn't exist a search result page for search string "%s" is shown.

On many projects there exist a redirect from [[%s]] to the Main Page of the project so these users gets redirected to a useful page. But this redirect is workaround. This workaround has also the disadvantage that the Main Page is shown on a strange URL.

I suggest to create a workaround in MediaWiki to catch this request:

When [[%s]] is not existent then
?search=%s&title=Special%3ASearch
redirects to the Main Page.

When [[%s]] is not existent then
?search=%s&title=Special%3ASearch&fulltext=Search
shows a search result page to the search string "%s"

When [[%s]] exists then
?search=%s&title=Special%3ASearch
redirects to this articel [[%s]]

When [[%s]] exists then
?search=%s&title=Special%3ASearch&fulltext=Search
shows a search result page to the search string "%s"

I created a patch with this behavior.


Version: 1.23.0
Severity: enhancement

Attached:

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 2:28 AM
bzimport set Reference to bz57318.
bzimport added a subscriber: Unknown Object (MLST).

Hi Fomafix, thanks for your patch!
You probably know, but you are welcome to use Developer access

https://www.mediawiki.org/wiki/Developer_access

to submit this as a Git branch directly into Gerrit:

https://www.mediawiki.org/wiki/Git/Tutorial

mr.heat wrote:

I'm sorry, but I don't support this. See our discussion in the German Wikipedia.[1]

The patch introduces a hard coded redirect for an - in my opinion - way to specific case. What if an user enters "wp %s" because he wants to search for "%s". With the proposed patch he will be redirected to the main page. What if an other user agent does not use "%s" but "{0}" or "$0" or something like that instead? Do we have to add this too?

My suggestion is to fix bug 48028. All redirects should do real 301 redirects. This will also fix other problems like not being able to copy & paste the real URL of an article when it's called via a redirect. This way we can keep the redirect [[%s]] without confusing visitors with a strange "%25s" in the URL.

[1]http://de.wikipedia.org/wiki/Wikipedia:Löschkandidaten/19._November_2013#.25s_.28Weiterleitung_auf_die_Hauptseite.29

[[Talk:%s]] has the history of this Firefox quirk, I think.

Change 231316 had a related patch set uploaded (by Gerrit Patch Uploader):
Search: Redirect to Main Page on search for %s

https://gerrit.wikimedia.org/r/231316

Deskana claimed this task.
Deskana subscribed.

This does not seem like a good idea to me. We shouldn't include specific exceptions like this. For example, [[%s]] actually exists on the English Wikipedia, and doing this would make it significantly more difficult to find it.

For example, [[%s]] actually exists on the English Wikipedia, and doing this would make it significantly more difficult to find it.

This is not correct. There is no change for the English Wikipedia. See task description:

When [[%s]] exists then
?search=%s&title=Special%3ASearch
redirects to this articel [[%s]]

When [[%s]] exists then
?search=%s&title=Special%3ASearch&fulltext=Search
shows a search result page to the search string "%s"

This is the current behavior.

This is not correct. There is no change for the English Wikipedia.

Thanks for pointing that out, I missed that. Still, I don't think including an exception in core makes sense in this case.

Many projects have redirects from %s to the main page. Redirects have many disadvantages:

  • %s is not a wanted "content".
  • The redirect occurs on special pages.
  • Not all projects can make such redirects, for example Wikidata.

This change makes these redirects superfluous.

%s on the German Wikipedia (which is a the largest project redirecting it to the main page) gets about 400 hits a day (as a baseline, the first article I pulled up via Special:Random gets 10). So there is a significant number of readers for whom this would make their user experience less confusing. (IIRC Firefox versions around 3.5 used to have a smart bookmark for Wikipedia by default; new versions don't, but upgrades keep old bookmarks so presumable a large number of users still have it.)

OTOH most editors create new articles by typing the name in the search bar, so creating %s would become more confusing, but that's not something that happens a lot.

So merge or abadone the patch? Someone with +2 need to abadone it, if needed.

Change 231316 abandoned by Deskana:
Search: Redirect to Main Page on search for %s

Reason:
Abandoning this patch as it's been sat around with an unaddressed -2 for a while. If someone wants to pick this up and work on it, please do feel free to restore the patch.

https://gerrit.wikimedia.org/r/231316

So merge or abadone the patch? Someone with +2 need to abadone it, if needed.

I abandoned the patch without prejudice; if someone wants to work on it, they can absolutely restore it and do that.