Page MenuHomePhabricator

On redirect, parts of the search query are not filled into the main search bar
Closed, ResolvedPublic3 Story Points

Description

Motivation
AdvancedSearch does not automatically fill in the form, but allows users to search with the main bar, as well as with the form.
When a user is redirected to the search page, and some keywords are already in use, these should be added to the main search bar.

Example
I am on a page with an integrated search field. This search field automatically sets "prefix=Wikipedia%3ABibliotheksrecherche%2FAnfragen%2F" in the url. Once the special:search page is reached, this is removed. That means if I change the page or search again, the constraint is gone.

Sample queries
How the query used to look like:
https://de.wikipedia.org/wiki/Spezial:Suche?search=besondere+beilage&prefix=Wikipedia%3ABibliotheksrecherche%2FAnfragen%2F&fulltext=Archiv+durchsuchen&fulltext=Search&searchToken=ej2h54kofwcxduty9kt3fck6w

How it looks like with advancedSearch enabled: https://de.wikipedia.org/w/index.php?advancedSearchOption-original=literarische+beilage&search=literarische+beilage&title=Spezial:Suche&profile=advanced&fulltext=1&advancedSearchOption-filetype=&advancedSearch-current=%7B%22options%22%3A%7B%7D%2C%22namespaces%22%3A%5B%220%22%5D%7D&ns0=1&searchToken=a4sn3yyitxdreb1rc0x34bavg

This bug was reported on the help talk page

Acceptance Criteria

  • When a user is redirected to special:Search, all of the given search parameters can be found in the "traditional" search box

Event Timeline

Restricted Application added a project: TCB-Team. · View Herald TranscriptFeb 28 2018, 11:01 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Lea_WMDE updated the task description. (Show Details)Feb 28 2018, 1:47 PM
Lea_WMDE triaged this task as Normal priority.Feb 28 2018, 1:49 PM
Lea_WMDE set the point value for this task to 3.
Pablo-WMDE moved this task from Todo to Doing on the WMDE-Fundraising-Sprint-18 board.
Pablo-WMDE added a comment.EditedMar 5 2018, 2:22 PM

Findings:

  • the linked sample relies on a "prefix" parameter used in Extension:InputBox (the German documentation is better structured than the English), fulltext and search types.
  • they use a dedicated, undocumented(?) "prefix" parameter for Special:Search, i.e. not part of the "search" GET parameter but a separate one. All(?) GET parameters with influence on search result:
    • search (&search=) Example known
    • namespaces (&ns12=1&ns13=1) Example known (but broken) = T182254
    • prefix (&prefix=) Example new to me
    • searchfilter (&searchfilter=...) Example new to me
  • an attempt to remove the prefix parameter in the past was reverted https://github.com/wikimedia/mediawiki/commit/a5bbbf35c8884dae7df1bbf37fdc5f65d02c2778
  • mediawiki's frontend code itself seem to be unaware of the "prefix" parameter, mw.config.get('searchTerm') does not contain it - no wonder we missed it
  • the "searchfilter" parameter gets appended to the "search" parameter, i.e. mw.config.get('searchTerm') == "fish chips"
  • identical results can be achieved searching for either
    • /wiki/Spezial:Suche?search=besondere+beilage&prefix=Wikipedia%3ABibliotheksrecherche or
    • /wiki/Spezial:Suche?search=besondere+beilage+prefix:Wikipedia%3ABibliotheksrecherche (mind the plus after "beilage")

Q (to @Lea_WMDE):

  • does advancedSearch have to be compatible with the dedicated "prefix" GET parameter?
  • does advancedSearch have to be compatible with the dedicated "searchfilter" GET parameter?
Pablo-WMDE added a comment.EditedMar 5 2018, 5:06 PM

Worst case link https://www.mediawiki.org/wiki/Special:Search?search=endless&prefix=Wikipedia%3ABibliotheksrecherche&searchfilter=joy makes for search field input endless joy prefix:Wikipedia:Bibliotheksrecherche.

Steps to resolve this could be (in descending likelihood)

/cc @gabriel-wmde @Tonina_Zhelyazkova_WMDE @thiemowmde

Pablo-WMDE removed Pablo-WMDE as the assignee of this task.Mar 6 2018, 8:48 AM
Pablo-WMDE removed Pablo-WMDE as the assignee of this task.
Pablo-WMDE moved this task from Doing to Todo on the WMDE-Fundraising-Sprint-18 board.
Pablo-WMDE added a subscriber: Pablo-WMDE.
Pablo-WMDE added a subscriber: Pablo-WMDE.

Storytime discussion resulted in the decision to use the actual general search field, instead of replacing it (unless the code gives us a reason to reconsider)

gabriel-wmde moved this task from Todo to Doing on the wmde-fundraising-sprint-19 board.

Change 418951 had a related patch set uploaded (by Gabriel Birke; owner: Gabriel Birke):
[mediawiki/extensions/AdvancedSearch@master] Leave original search field in place

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

gabriel-wmde removed gabriel-wmde as the assignee of this task.Mar 12 2018, 6:18 PM
gabriel-wmde moved this task from Doing to Review on the wmde-fundraising-sprint-19 board.

Change 418951 merged by jenkins-bot:
[mediawiki/extensions/AdvancedSearch@master] Leave original search field in place

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

Lea_WMDE closed this task as Resolved.Mar 23 2018, 12:23 PM