Page MenuHomePhabricator

Wikimedia Commons deepcategory searches return unexpected results for categories with "&" in name
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue
There is a bug in cases where the category name has an "&". Example: "Pellerin & Cie"
Try a deepcat search on this commons category by using the button under More>

https://commons.wikimedia.org/w/index.php?title=Special:Search&limit=100&search=deepcategory%3A%22Pellerin_&_Cie%22&ns0=1&ns4=1&ns6=1

Expected to find all files in deepcat:"Pellerin & Cie"

ERROR:
the results of this search are: deepcategory:"Pellerin_
No matches because the folder name is truncated at the "&".

What should have happened instead?:
deepcat:"Pellerin & Cie" should have been completely indexed

Event Timeline

This does not sound like something that the Commons community can solve itself; adding CirrusSearch which is the search codebase.

Thanks for reporting this, @Pelikana. I tried to reproduce this, but I can't find the "More >" button mentioned in your description. Typing "Pellerin & Cie" into either the autocomplete search input or the Special:Search shows the expected results. Apparently, the URL you mention does not escape the query correctly. '&' is a reserved character in URLs to separate query parameters. For example, https://commons.wikimedia.org/w/index.php?search=deepcategory%3A%22Pellerin+%26+Cie%22&title=Special%3ASearch&profile=advanced&fulltext=1&ns0=1&ns4=1&ns6=1 correctly escapes the ampersand as %26. That said, in order to help here, we first have to know where this link comes from.

Hi, the More button on category pages appears for logged-in users if in their user preferences in Gadgets are set to use some of the Aids for Categorisation: option 4 and 6 should be checked : 4=add search links ... 6: Deepcat Search. After that the More button should be visible on top menu next to history tab. When looking at example cat Braun & Hogenberg and try a deepcat search using this button it will show the error. Thanks

I'm using a custom made add-on; a fork of this to do the reverse; to do quoted -deepcat searches outside of the cat we are looking at and it works well after a certain fix around this kind of bug. This update can be seen here: https://commons.wikimedia.org/w/index.php?title=User:Samwilson/Searchnotincat.js&diff=next&oldid=933232426 So here might be found a hint or an example of what a possible fix could look like. This fork works well.