Page MenuHomePhabricator

Search returns invalid suggestions (Page not found) due to namespace corruption
Closed, DuplicatePublic

Description

Searching for "session" on https://www.mediawiki.org returns a result for https://www.mediawiki.org/wiki/Manual:Session.name despite it being a 404 Not Found, and that page never having existed.

This started happening when the searchSuggest code in MediaWiki was updated to change the OpenSearch API query to default to using all "content" namespaces instead of only the main namespace (more specifically, by using the user preferences for search namespaces, which defaults to content namespaces only).

The "Manual" namespace on MediaWiki is considered content, and some of the results are indeed genuine Manual pages, but "Session.name" is actually a main namespace page.

Broken query:

https://www.mediawiki.org/w/api.php?action=opensearch&format=jsonfm&search=session&namespace=0%7C100

response
[
    "session",
    [
        "Manual:SessionManager and AuthManager",
        "Manual:SessionManager and AuthManager/Updating tips",
        "Manual:SessionManager and AuthManager/Linked accounts",
        "Manual:SessionManager and AuthManager/Troubleshooting",
        "Manual:Session.name"
    ],
    [
        "SessionManager and AuthManager are two authentication-related frameworks introduced in MediaWiki 1.27 that are intended to replace the \"there can be only one!\" nature of AuthPlugin, the inability to do federated login (e.g., \"log in with your Google account\") without using various hooks to hack around MediaWiki's focus on password-based authentication, and the inability to do session management with anything other than cookies without again using various hooks to hack around MediaWiki's reliance on PHP's cookie-based sessions.",
        "This list common situations in extensions that will need updating for SessionManager and AuthManager, and general fixes.",
        "AuthManager introduces the concept of account linking; authentication providers that use some external service (for example, meta.wikimedia.org via OAuthAuthentication to allow logging in with Wikimedia accounts on non-Wikimedia wikis, or google.com via GoogleLogin to use Google's single sign-on) can bind remote accounts to local ones and manage them.",
        "",
        ""
    ],
    [
        "https://www.mediawiki.org/wiki/Manual:SessionManager_and_AuthManager",
        "https://www.mediawiki.org/wiki/Manual:SessionManager_and_AuthManager/Updating_tips",
        "https://www.mediawiki.org/wiki/Manual:SessionManager_and_AuthManager/Linked_accounts",
        "https://www.mediawiki.org/wiki/Manual:SessionManager_and_AuthManager/Troubleshooting",
        "https://www.mediawiki.org/wiki/Manual:Session.name"
    ]
]

Different query for comparison (main-namespace only)

https://www.mediawiki.org/w/api.php?action=opensearch&format=jsonfm&search=session&namespace=0

[
    "session",
    [
        "SessionManager",
        "Session.name"
    ],
    [
        "",
        ""
    ],
    [
        "https://www.mediawiki.org/wiki/SessionManager",
        "https://www.mediawiki.org/wiki/Session.name"
    ]
]

Event Timeline

Krinkle created this task.Nov 29 2017, 2:12 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 29 2017, 2:12 AM
Krinkle renamed this task from MediaWiki search suggestion returning 404 due to wrong namespace prefix to Search returns invalid suggestions (Page not found) due to namespace corruption.Nov 29 2017, 8:52 PM
debt triaged this task as High priority.Nov 30 2017, 6:06 PM
debt edited projects, added Discovery-Search (Current work); removed Discovery-Search.

Related to: T115756