apps-android-commons
apps-android-commons copied to clipboard
Hidden category not found by exact name
I apply a location-and-date category such as [[Category:United Kingdom photographs taken on 2021-01-19]]
to all my images.
Presumably because these are hidden categories, they are not found by the app's category search.
In settings, please provide an option to have hidden categories found on the category search page (alternatively, please provide the option on that search page, so that it can be activated on an image-by-image basis).
If neither of these is possible please provide the option to enter the category name manually.
@nicolas-raoul do u recommend providing this option in settings or on the category selection screen or both?
Category search is already very buggy (in part because of server-side issues) so I am hesitant to add settings to it, as settings tend to slow down bug resolution (because different people experience different behaviors).
"please provide the option to enter the category name manually"
That sounds reasonable. Even for non-hidden categories, sometimes typing the exact category name does not make it appear in search (presumably because the API does not like some characters such as parenthesis).
So, an enhancement would be, each time a string is entered or modified in the upload wizard's category search dialog:
- Perform the API search call (already implemented)
- Perform a second API call to check whether the typed string is the exact name of an already existing category. It could be as crude as calling https://commons.wikimedia.org/w/api.php?action=parse&page=Category:Rabbits&prop=wikitext&formatversion=2 and checking whether this returns an error or not. Error case: https://commons.wikimedia.org/w/api.php?action=parse&page=Category:This_category_does_not_exist&prop=wikitext&formatversion=2
- Perform a second API call to check whether the typed string is the exact name of an already existing category. It could be as crude as calling https://commons.wikimedia.org/w/api.php?action=parse&page=Category:Rabbits&prop=wikitext&formatversion=2 and checking whether this returns an error or not. Error case: https://commons.wikimedia.org/w/api.php?action=parse&page=Category:This_category_does_not_exist&prop=wikitext&formatversion=2
I'm wondering if you would really need to invoke the parse
action. Wouldn't it be more relevant to just use the query
action without any of the local filtering that we do?
Success: https://commons.wikimedia.org/w/api.php?action=query&format=json&prop=categoryinfo&titles=Category%3ARabbits
Error: https://commons.wikimedia.org/w/api.php?action=query&format=json&prop=categoryinfo&titles=Category%3AThis_category_does_not_exist
Thanks @sivaraam that's indeed much better!
Thanks @sivaraam that's indeed much better!
- Perform a second API call to check whether the typed string is the exact name of an already existing category. It could be as crude as calling https://commons.wikimedia.org/w/api.php?action=parse&page=Category:Rabbits&prop=wikitext&formatversion=2 and checking whether this returns an error or not. Error case: https://commons.wikimedia.org/w/api.php?action=parse&page=Category:This_category_does_not_exist&prop=wikitext&formatversion=2
I'm wondering if you would really need to invoke the
parse
action. Wouldn't it be more relevant to just use thequery
action without any of the local filtering that we do?Success: https://commons.wikimedia.org/w/api.php?action=query&format=json&prop=categoryinfo&titles=Category%3ARabbits
Error: https://commons.wikimedia.org/w/api.php?action=query&format=json&prop=categoryinfo&titles=Category%3AThis_category_does_not_exist
If I understood correctly, Lets suppose that the text entered in search bar matches a category (hidden), then in that case we should shown it in suggestion box right? If true then won't it be difficult for users as they still have to manually type in category name, rather than us providing suggestions?
Please correct me if I am wrong.
After performing API calls 1 and 2, you would concatenate the results:
- Result of API call 2 (if not an error) as the first suggestion.
- Results of API call 1 as the rest of the suggestions.
After performing API calls 1 and 2, you would concatenate the results:
- Result of API call 2 (if not an error) as the first suggestion.
- Results of API call 1 as the rest of the suggestions.
ok got it thanks. @sivaraam would u like to work on this? if not I will. Thanks : )
ok got it thanks. @sivaraam would u like to work on this? if not I will. Thanks : )
You could feel free to work on it 🙂