Page MenuHomePhabricator

Search suggestions broken on als.wikipedia.org
Closed, ResolvedPublic

Description

Author: clemens.kienzle

Description:
The drop-down search function on the Alemannic Wikipedia (als.wikipedia.org) only works while being on the recent changes page (http://als.wikipedia.org/wiki/Spezial:Letschti_%C3%84nderige). On any other page, the search engine will not display possible matches (even though it does take you to the page if you press search).


Version: unspecified
Severity: normal

Details

Reference
bz29595

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:34 PM
bzimport set Reference to bz29595.

I can confirm this, but noticed several really weird things trying to track it down.

Top of my suspects list: someone has created a global '$' function which is incompatibility with jQuery:

http://als.wikipedia.org/wiki/MediaWiki:Common.js

This definitely causes trouble when loading with ?debug=true -- I can see a $('body').is('.rtl') call failing in some of the Vector extension setup bits, which probably stops the SimpleSearch setup somewhere along the line.

I don't see the exact same failure when loading without debug=true, but may be other related things interfering.

(In reply to comment #1)

I don't see the exact same failure when loading without debug=true, but may be
other related things interfering.

That's because in non-debug mode, we do automagic (function($) { code })(jQuery); wrapping, but in debug mode we load files raw. This is why files MUST ALWAYS be wrapped that way if they use $ as an alias for jQuery.

clemens.kienzle wrote:

Unfortunately there is currently no one active at als.wikipedia who knows much about this. Could someone tell us what exactly the suggestion at http://als.wikipedia.org/wiki/MediaWiki_Diskussion:Common.js means? That way I could implement it, or else someone could be given temporary adminship.

Per comment #1, while alswiki can work around this by changing their local scripts, this is a bug that should be fixed in the software. I'll poke this later today.

I ran a tour [1] on als.wikipedia.org just now.

Should be fixed.

clemens.kienzle wrote:

The search function still isn't working though for me and at least one other user.

There's also the problem that a few high-profile templates that apparently relied on this script have stopped working. Most importantly: http://als.wikipedia.org/wiki/Vorlage:Titel, this is very serious because our articles are saved under the Standard German title, but have the Alemannic title displayed through a template. This means that virtually every page is affected (see http://als.wikipedia.org/wiki/Honigbuck). This is a bit off-topic, but is anyone able to fix that template?

als.holder wrote:

It seems that the magic word DISPLAYTITLE doesn't work on alswikipedia.org.

(In reply to comment #4)

Per comment #1, while alswiki can work around this by changing their local
scripts, this is a bug that should be fixed in the software. I'll poke this
later today.

I did this (aliased $ properly so redefining $ doesn't break search) just now.

(In reply to comment #8)

It seems that the magic word DISPLAYTITLE doesn't work on alswikipedia.org.

DISPLAYTITLE works fine. Note that Wikipedia has a restriction on DISPLAYTITLE: It must match the actual title when decoding it. So one can't display "Hùùnibùg" on "Honigbuck" or vice versa.

But using DISPLAYTITLE:eBay on article "EBay" (notice the lower-case e) will work fine.

Anyway, if there are issues with it still, please open a seperate bug.

clemens.kienzle wrote:

The DISPLAYTITLE thing is a separate issue, I just brought it up in case someone had a quick fix to it. But the actual reason I reopened this is because the search function still isn't working.

als.holder wrote:

Krinkle, I'm really sorry, but I had to reset all your changes. Search function still wasn't working properly and our template "Vorlage:Titel" is very important because it affects nearly all articles. Perhaps a solution could be found without "damaging" that template? Kind regards.

What exactly is broken ? The search itself works fine: http://i.imgur.com/XHuhQ.png

The search suggestions work fine too: http://i.imgur.com/NBaGH.png

I've renamed the title as I suspect your report is about the suggestions underneath during the typing, not about the search itself. ("drop down menu").

How exactly is that template related to the search ?

Why did you undo all modifications I made to the site scripts ? What exactly broke where ? Samples and screenshots will help if you want me to fix it.

clemens.kienzle wrote:

Strange that the search suggestions work for you, they don't work for me (or any other users I've talked to). It will take me to the article if I enter the whole title, but it won't display any suggestions as I type.

Holder undid the modifications because several templates stopped working. Most importantly: http://als.wikipedia.org/wiki/Vorlage:Titel

On als.wikipedia, all articles are saved under the Standard German keyword, but the Alemannic title is displayed through the above template. For example, on http://als.wikipedia.org/wiki/Kartoffel the title is displayed as "Härdöpfel".

Something in the changes you made caused this template to stop working. So instead of "Härdöpfel" it would display "undefined". Since this affects nearly all pages, it is pretty serious.

Maybe we should first figure out why "Vorlage:Titel" doesn't work with your modifications, and then figure out the search function? Should I open a new bug for that?

als.holder wrote:

I undid all your modifications because I didn't know which of them was responsible for the breaking of the template.

I don't think that the template is related to the search function.

Search suggestions don't work for me too. Perhaps this depends on the used browser? I'm using Firefox 5.0.

als.holder wrote:

Krinkle, I've taken over your global.js skript on meta, now search suggestions are working fine for me :-).

als.holder wrote:

On the other side the title template isn't working now. It seems that there is indeed a relation between this template and the search suggestions ...

As of 2011-11-14, search suggestions do not work for me on als.wikipedia.org.

As of 2011-11-14, the magic title replacement when using {{Titel}} does work for me on als.wikipedia.org.

Bug 32366 appears to just be a continuation of this bug, so I'll merge it in.

  • Bug 32366 has been marked as a duplicate of this bug. ***

So here's your problem.

The code that does the properTitle replacement is in another script:

https://als.wikipedia.org/w/index.php?title=MediaWiki:If-pTitle.js

which never got updated.

If that was getting run with regular jQuery back in the $ slot, it would fail here:

var pTitle = $("pTitle").innerHTML;

returning "undefined". which would then get used in the title replacement.

Ok I've resolved some of the main breakages -- and the title script is updated to work -- but the search suggestions still aren't working for me, so I'll have to poke a little more. Will return shortly.

The actual search suggestions appear to have been broken by this script:
https://de.wiktionary.org/wiki/MediaWiki:If-search.js

which appears to blindly destroy any DOM attachments such as, say, event handlers in the search form. I've removed it as it's unclear what it's even for.

Ok I think I've got these all worked out now. I've also removed the If-search.js script that was being pulled in from the master copy on de.wiktionary.org; that script itself is broken (it's what stopped search suggestions from working) and appears to be of limited/no use at present.

I've checked in with Krinkle about that script; it may get tweaked in future to work cleaner or be dropped entirely, depending.

Currently I see working search suggestions, the title replacements work, and the SSL mixed-mode warnings I was seeing on https://als.wikipedia.org/ appear to now be resolved. Please give a shout if anything else is broken!

clemens.kienzle wrote:

Everything appears to be working fine now (at least after clearing my browser). Awesome! Thank you so much for your work!