Search code examples
mediawikimediawiki-api

How do I search for Wikipedia pages that have all the words in my set


I have two terms A and B (strings) and I want all Wikipedia pages that have both these terms A and B, with no constraint regarding the order in which they appear and any phrase query or anything like that. I just want all result pages to be containing both these terms.

What is the syntax of the MediaWiki query that I should be constructing for the srsearch parameter?

Should I use srsearch="A|B" or srsearch="A&B" or srsearch="A,B" or srsearch=A|B

From the results I am getting, I am unable to make this decision.

Any advise is highly appreciated.


Solution

  • Separate them by space, no quotes.

    srsearch=A B
    

    Or, as a URL,

    http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=A+B
    

    (+ denotes a space in URLs.)