Don't show hidden categories in suggested categories
See original GitHub issueSummary: When uploading an image, we ask users to add categories relevant to the image. Currently, the list of categories that we show also includes hidden categories. According to the Commons page about hidden categories:
Many non-topical categories are marked with HIDDENCAT or {{Hiddencat}} on the category page.
As they’re non-topical there’s not much use in suggesting those categories. Also, I’ve observed that hidden categories are generally added automatically to the corresponding pages and are not meant to be manually added by users. Examples:
- Category:Pages using authority control without Wikidata link - Wikimedia Commons
- Category:Uses of Wikidata Infobox - Wikimedia Commons
There really seem to be a lot of hidden categories in Commons. Not showing the hidden categories would improve the relevancy of the category search results as it would reduce a lot of irrelevant categories, IMO.
API that could be used
We can identify hidden categories by sending the acprop=hidden
to the allcategories
API. There seems to be a limitation though. The generator version of that API doesn’t seems to be considering the gacprop=hidden
parameter sent to it. Something to look into if we consider doing this.
Example API queries (for reference)
- Using
list=allcategories
: https://commons.wikimedia.org/w/api.php?action=query&format=json&formatversion=2&list=allcategories&acprefix=pages&aclimit=200&acprop=hidden - Using
generator=allcategories
: https://commons.wikimedia.org/w/api.php?action=query&format=json&formatversion=2&generator=allcategories&gacprefix=pages&gaclimit=200&gacprop=hidden
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (8 by maintainers)
Top GitHub Comments
Personally I agree that hidden categories should not be shown. However I think the best way to solve this would be to wait for upstream to make the changes, rather than making a switch prematurely (wasted resources if they are going to do it anyway, and potential side effects).
@PaulinaQuintero You’re observation is right. The generator doesn’t consider
gacprop=hidden
as mentioned in the description. I think the related code also confirms this.Indeed, requesting the generator API to consider the
gacprop=hidden
would be the easiest way to solve this. As a first step, search for already open issues related to this on https://phabricator.wikimedia.org/ If you couldn’t find any please open a new one with theMediaWiki-API
tag.That would take some time. In the mean time, let’s see if someone here could weigh in on whether switching to the
list
version of the API is a good/bad thing. cc @maskaravivek @misaochan