In our Mobile apps, we're implementing full-text searching when the user types a search term. The way we query the api is as follows:
- We use prop=pageprops with generator=search to get the list of results, which also gives us the image thumbnail and Wikidata ID for each result, but this returns the results in the wrong order, so:
- We combine the query with list=search, which should give the same set of results (albeit without thumbnails or Wikidata ID), but in the correct order.
- We then correlate the data from the two lists (expecting both lists to contain the exact same items) to arrive at the full results in the correct order.
For example, our query is something like this:
The two sets of results often don't match up with each other -- there are sometimes one or more pages in one list that are not present in the other. What's even more strange, this doesn't happen every time: the lists might match up in one instance, and then be different in another (for the exact same query).
For example, try executing the query linked above, and observe the last item in the returned "pages" array. 4 out of 5 times, the item will be "There's No One as Irish as Barack O'Bama", but sometimes it becomes "Statewide opinion polling for the United States presidential election, 2012", which is no longer consistent with the other list returned by list=search.