https://bugzilla.wikimedia.org/show_bug.cgi?id=57318

       Web browser: Firefox
            Bug ID: 57318
           Summary: Search for %s opens Main Page
           Product: MediaWiki
           Version: 1.23-git
          Hardware: All
                OS: All
            Status: NEW
          Keywords: patch
          Severity: minor
          Priority: Unprioritized
         Component: Search
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified
   Mobile Platform: ---

Created attachment 13854
  --> https://bugzilla.wikimedia.org/attachment.cgi?id=13854&action=edit
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to