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?
Asked
Active
Viewed 561 times
1
-
The search API should perform "a full text search". Do you have a specific example that is not working as expected? – AXO Dec 13 '20 at 12:03
-
If you search for "Nelson Mandela" on the English Wikipedia, you get 5901 [results](https://en.wikipedia.org/w/index.php?search=Nelson+Mandela&title=Special:Search&profile=advanced&fulltext=1&advancedSearch-current=%7B%7D&ns0=1), many of them without any mentions of Nelson Mandela in the title. Running the Python example from [the search API](https://www.mediawiki.org/wiki/API:Search) gives 10 results. Am I missing some parameters? – Stoyan Dimitrov Dec 13 '20 at 15:51
1 Answers
1
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.

AXO
- 8,198
- 6
- 62
- 63
-
1I guess continuation means [using a loop like this](https://stackoverflow.com/a/48844795/7388910). It worked, thanks! – Stoyan Dimitrov Dec 14 '20 at 17:53