MediaWiki api.php's search query module requires explicitly listing all values for srnamespace parameter
Closed, ResolvedPublic

Description

So looking at https://commons.wikimedia.org/w/api.php?action=help&modules=query+search:

srnamespace

    Search only within these namespaces. 

    Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 100, 101, 102, 103, 104, 105, 106, 107, 460, 461, 490, 491, 828, 829, 1198, 1199, 2300, 2301, 2302, 2303, 2600

    Default: 0

Is there a way to search all namespaces? index.php can with profile=all, but it doesn't look like srnamespace has equivalent functionality. Similar to how we support a value of max in parts of the API, it might be nice to have an all-type value accepted for srnamespace.

Event Timeline

MZMcBride raised the priority of this task from to Needs Triage.
MZMcBride updated the task description. (Show Details)
MZMcBride subscribed.
Anomie triaged this task as Lowest priority.Jan 19 2016, 3:36 PM
Anomie set Security to None.
Anomie moved this task from Unsorted to Needs Code on the MediaWiki-Action-API board.

Note if anyone decides to try this, your approach should be to look at the handling of the namespace parameter in ApiBase rather than looking at ApiSearch.

Is there a way to search all namespaces?

Yes, by specifying all the values, separated by pipes. The list of valid values may be fetched in a machine-readable format using action=paraminfo.

Change 292527 had a related patch set uploaded (by Unicornisaurous):
Add 'all' option for namespace API parameters

https://gerrit.wikimedia.org/r/292527

Change 292527 merged by jenkins-bot:
Add PARAM_ALL setting for multi-option API parameters

https://gerrit.wikimedia.org/r/292527

Nice. Thank you, Anomie and Unicornisaurous!