Page MenuHomePhabricator

[S] [Tech Debt] Swap out page/related API call with MediaWiki API equivalent
Closed, ResolvedPublic

Description

Our explore feed calls the RESTbase page/related API to populate the "Because you read" card data. We need to switch this with a MediaWiki call as described in this spike.

Current call: https://en.wikipedia.org/api/rest_v1/page/related/Cat
Location of call: https://github.com/wikimedia/wikipedia-ios/blob/08f5693881a6d0fac23e649643f673a3fb4e724e/WMF%20Framework/RelatedSearchFetcher.swift#L18

Expected call: https://en.wikipedia.org/w/api.php?action=query&exchars=100&exintro=1&explaintext=1&formatversion=2&generator=search&gsrlimit=20&gsrnamespace=0&gsrqiprofile=classic_noboostlinks&gsrsearch=morelike%3ACat&origin=*&pilimit=20&piprop=thumbnail&pithumbsize=160&prop=pageimages|description|info&format=json&inprop=varianttitles

We should use the the varianttitles object to populate the new article title, so that it reflects the correct variant for ZH Wiki. Note we will not have a variant object for the article description. That is an expected bug.

We should also ensure the UI can handle a missing description, since we won't be leaning on extract.

UI:

IMG_9518.PNG (2×1 px, 996 KB)

IMG_9519.PNG (2×1 px, 377 KB)

QA Notes

Ensure the "Because you read" Explore card and the screen after tapping "Additional related articles" works as it did before. The expected changes are that the ordering of the article list may be a little different, and there may be more articles missing a description label. This change was ok'ed by Product in https://phabricator.wikimedia.org/T352801#9388174.

Event Timeline

Tsevener renamed this task from [Tech Debt] Swap out page/related API call with MediaWiki API equivalent to [S] [Tech Debt] Swap out page/related API call with MediaWiki API equivalent.Jul 11 2024, 5:09 PM

@dcausse @MSantos

We are in the process of switching this over on iOS. I wanted to call out that our UI expects 20 results, so we are requesting that many. From what I can see Android requests 5. Will 20 results be a problem on the backend?

We will add the smaxage and maxage parameters as suggested in https://phabricator.wikimedia.org/T352801#9402209.

Thanks!

@dcausse @MSantos

We are in the process of switching this over on iOS. I wanted to call out that our UI expects 20 results, so we are requesting that many. From what I can see Android requests 5. Will 20 results be a problem on the backend?

No I don't think so since it should be pretty much the same api call you were using previously, note that if I not mistaken and assuming that /api/rest_v1/page/related was served by restbase the introduction of gsrqiprofile=classic_noboostlinks might slightly change the ordering of the results you were used to but should be consistent with what mobile web is doing.

@dcausse yep I did notice the change in ordering. That won't be a problem, thank you!

Tsevener added a subscriber: Mazevedo.

Can be tested starting in TestFlight 7.5.6 (3753).

I'm not able to trigger the "Because you read" Recording in any language testing in 7.5.6 (3780), I may not be testing correctly

@HNordeenWMF yeah the logic is kinda difficult to reproduce. From what I can tell the related pages card should appear for any articles that you read for 30+ seconds, three days ago, or any article you saved three days ago. So you may need to change your device date to trigger the three days ago logic.

HNordeenWMF claimed this task.