Last modified: 2014-02-18 11:31:37 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T59318, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 57318 - Search for (Firefox smart keyword) %s opens Main Page
Search for (Firefox smart keyword) %s opens Main Page
Status: NEW
Product: MediaWiki
Classification: Unclassified
Search (Other open bugs)
1.23.0
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-20 19:36 UTC by Fomafix
Modified: 2014-02-18 11:31 UTC (History)
4 users (show)

See Also:
Web browser: Firefox
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
patch for includes/specials/SpecialSearch.php (621 bytes, patch)
2013-11-20 19:36 UTC, Fomafix
Details

Description Fomafix 2013-11-20 19:36:38 UTC
Created attachment 13854 [details]
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.
Comment 1 Andre Klapper 2013-11-20 19:48:49 UTC
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
Comment 2 TMg 2013-11-21 14:25:08 UTC
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
Comment 3 MZMcBride 2013-11-22 05:44:34 UTC
[[Talk:%s]] has the history of this Firefox quirk, I think.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links