Page MenuHomePhabricator

Handle query continuation/batchcomplete correctly
Closed, InvalidPublic

Description

We have never handled this 100% correctly, but possibly should, if there are queries in the app for which it's necessary.

When you make an API request using a generator together with properties, the API result may signal to continue because there are more properties to retrieve for the pages so far, or because there are more pages from the generator, or both. From version 1.25 onwards, the API returns a batchcomplete element to indicate that all data for the current "batch" of pages has been returned. This can be useful to avoid building a combined result set for thousands of pages when using a generator together with prop modules that may themselves need continuation.

https://www.mediawiki.org/wiki/API:Query#batchcomplete

Do we have queries for which we expect the result set to be sufficiently large or complex that this will come into play?

Current classes using a generator query and potentially needing updating include:

  • TitleSearchTask
  • FullSearchArticlesTask
  • GalleryCollectionFetchTask
  • BecauseYouReadClient
  • NearbyClient

Event Timeline

Change 347118 had a related patch set uploaded (by Mholloway):
[apps/android/wikipedia@master] Hygiene: Add TODO to BatchUtil.makeBatches

https://gerrit.wikimedia.org/r/347118

Change 347118 merged by jenkins-bot:
[apps/android/wikipedia@master] Hygiene: Add TODO to BatchUtil.makeBatches

https://gerrit.wikimedia.org/r/347118

The search clients/queries present an interesting case. For stub queries like 'b', we would expect there to almost certainly be continuation results available. On the other hand, if that's the search query, it's probably just because the user hasn't finished typing yet, and also we know that when they're done typing, in practice, users typically don't go very far down the results list before refining their queries or giving up. Maybe it's better just to go on as we have been with the first batch of results and not to bother with continuation for the search clients?

Closing this until we have a concrete case of misbehavior to address.