Page MenuHomePhabricator

Search results endpoint returns mixed variants regardless of Accept-Language header
Open, MediumPublicBUG REPORT

Event Timeline

Tsevener triaged this task as Medium priority.Feb 1 2021, 11:20 PM
Tsevener added a project: Discovery-Search.
Tsevener updated the task description. (Show Details)

@cooltey awesome, thanks! That gets us closer to having all the variant information. Looks we also need to append |info to the prop key in order for &inprop=varianttitles to work.

Question for you or anyone else that can answer - it doesn't seem like we'll have variant information for the redirected page titles or descripitions. See here for example:

https://zh.wikipedia.org/w/api.php?action=query&continue=&coprop=type%7Cdim&format=json&generator=prefixsearch&gpslimit=24&gpsnamespace=0&gpssearch=%E7%BE%8E%E5%9C%8B&list=search&pilimit=24&piprop=thumbnail&pithumbsize=120&ppprop=displaytitle&prop=description%7Cpageprops%7Cpageimages%7Crevisions%7Ccoordinates%7Cinfo&redirects=1&rvprop=ids&srinfo=suggestion&srlimit=1&srnamespace=0&sroffset=0&srprop=&srsearch=%E7%BE%8E%E5%9C%8B&srwhat=text&inprop=varianttitles

It returns an object like

"redirects": [{
	"index": 1,
	"from": "\u7f8e\u570b",
	"to": "\u7f8e\u56fd"
}],

Seems like we can look up the to value variants by looking for a title value under pages that matches, but what about from (we have a "Redirected from: nnnn" subtitle in some of our cells on search results)? The same goes for page descriptions, is there a way to get those variants?

"pageid": 153133,
"ns": 0,
"title": "\u7f8e\u570b\u570b\u6c11\u8b66\u885b\u968a",
"index": 20,
"description": "\u90e8\u961f",
"descriptionsource": "central",
"thumbnail": {
	"source": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/28/Seal_of_the_United_States_National_Guard.svg/120px-Seal_of_the_United_States_National_Guard.svg.png",
	"width": 120,
	"height": 120
},
...

@Tsevener

We are not handling the description or "redirected from XXX" for the search results since the API only returns the default one in zhwiki, and looks like there's no way to get the correct one easily.

If you have a strong feeling to fix it, you can call /page/summary/ to update each search result, which was my previous solution for this, but I choose not to process that because of the trade-off in loading speed.

@cooltey ok cool, thanks for confirming! @James_Dempsey I'll leave this task open since it would be nice to get it in the same call if possible, but it sounds like we'll probably match what Android is doing and show the un-converted redirect titles and descriptions for now.