Page MenuHomePhabricator

Search results "eating" span tag contained in search preview
Closed, ResolvedPublic


During the correction of Lint Errors on, I noticed that the search strings including a "</span>" might generate wrong previews. For instance, if I make a search with "insource:/pagina di \'\'\'\[\[Aiuto\:Aiuto\|aiuto\]\]\'\'\'\.\<\/span\>/" (here is the link:, the "</span>" isn't displayed in the previews. I've been told that this happens because of a "<span class="searchmatch">" wrapping each result, which gets closed by the tag in the result itself, that isn't consequentely displayed as expected. Is it possible to avoid this by preventing the matched text to be parsed as actual HTML?

EDIT: The search string I provided doesn't work anymore since every page with that error has been corrected. I can't find a string that will survive enough, but you can easily find one on your own: just make a search out of any "missing end tag" error with a faulty span and the error will pop up.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

@Daimona, can you create a page that is purposely broken so that we can take a look? Thanks!

@debt sure, I didn't create it before to avoid unintentional corrections. Now you can check the error on this sandbox of mine: All you have to do is check this link: As you can see, the stripped span is not displayed in the search result and this can be truly annoying, e.g. when looking for faulty spans. Thanks.

debt triaged this task as High priority.Sep 21 2017, 5:17 PM
debt edited projects, added Discovery-Search (Current work); removed Discovery-Search.

What it looks like (when broken):

Screen Shot 2017-09-21 at 11.15.38 AM.png (292×740 px, 58 KB)

Looks like this will be solved with T126563. Looking to see how hard that would be

Change 380564 had a related patch set uploaded (by EBernhardson; owner: EBernhardson):
[mediawiki/extensions/CirrusSearch@master] Stop eating <span> tags in highlighted output

Change 380564 merged by jenkins-bot:
[mediawiki/extensions/CirrusSearch@master] Stop eating <span> tags in highlighted output