Search code examples
mediawikiwikipediawikipedia-apimediawiki-api

How to search for terms in title and content using Wikipedia's API


On Wikipedia search box you can search for a term, e.g. 'lens', in article's title AND content. Using the search API however works only with titles. What request do I need to be able to extend the search on article content too?


Solution

  • The search API should perform "a full text search". The reason you're receiving only 10 results is most likely because you've not set the srlimit parameter which defaults to 10 and you're not continuing the query. You can set srlimit to max to receive 50 or 500 results (depends on the access level of your account) and in order to get the rest of the results one needs to continue the query using the parameters given in the last result.