更新时间:2022-10-17 18:55:43
MediaWiki has - by default - no built-in support for category building and querying intersections. To accomplish this task, extensions or external tools or multiple API queries and result processing is required.
On Wikimedia Commons, like on the whole Wikimedia Wiki farm, CirrusSearch powers filtered search, including search for category intersections and is also available through API (action=query&list=search&srsearch=incategory:A+-incategory:B
, this is Category:A
minus Category:B
).
One of the tools I can recommend (because it's a dedicated high-performance solution and actually running) is fastcci, developed by Daniel Schwen; specifically for Wikimedia Commons, there is already a database maintained and a webservice running but it's possible to set it up for any wiki, provided the tool set has a host to run on and has database access.
Consider the following query URL:
https://fastcci.wmflabs.org/?c1=3302993&c2=15516712&d1=0&d2=0&s=200&a=not&t=js
t=js
for a JSONP response; otherwise assumes being used as websocket)fastcciCallback( [ 'RESULT 27572680,0,0|1675043,0,0|27577015,0,0|27577043,0,0|27577106,0,0|27576896,0,0|27576790,0,0|23481936,0,0|17560964,0,0|11009066,0,0', 'OUTOF 10', 'DBAGE 378310', 'DONE'] );
RESULT
followed by a |
separated list of up to 50 integer triplets of the form pageId,depth,tag
. Each triplet stands for one image or category
Good pictures
button in any category page.
FilesOf('Category:Saaleck')
- FilesOf('Category:Rapeseed fields in Saxony-Anhalt')
GET
/w/api.php?action=query&pageids=page_IDs_separated_by_pipe
GET
/w/api.php?action=query&titles=Titles_separated_by_pipe