Page MenuHomePhabricator

index appears to be missing from search API responses if the page is a resolved redirect
Closed, DuplicatePublic

Description

Query: https://en.wikipedia.org/w/api.php?action=query&format=json&generator=prefixsearch&gpssearch=Queensland&gpslimit=10&ppprop=disambiguation&redirects=1&pithumbsize=80&pilimit=10&wbptterms=description&prop=info%7Cpageprops%7Cpageimages%7Cpageterms

That query returned ten results. Only six of those results have indexes to indicate their ordering. The other four didn't, and those were all resolved redirects. That seems like an error, because then the client has no idea what order those results should've been in.

If you delete the "&redirects=1" from the query, you get ten indices, one for each result, as expected: https://en.wikipedia.org/w/api.php?action=query&format=jsonfm&generator=prefixsearch&gpssearch=Queensland&gpslimit=10&ppprop=disambiguation&pithumbsize=80&pilimit=10&wbptterms=description&prop=info%7Cpageprops%7Cpageimages%7Cpageterms

Indices for resolved redirects should also be returned, so that the result set ordering is consistent and so the client knows how to order results.

Event Timeline

Deskana created this task.Aug 10 2015, 5:33 AM
Deskana raised the priority of this task from to Medium.
Deskana updated the task description. (Show Details)
Deskana added a subscriber: Deskana.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 10 2015, 5:33 AM
Deskana updated the task description. (Show Details)Aug 10 2015, 5:34 AM
Deskana set Security to None.

It may be wise to add some code into VisualEditor to deal with the possibility that the results come back without indices. But, probably not, because the API should just always return indices.

Deskana raised the priority of this task from Medium to High.Aug 10 2015, 5:50 AM
Deskana added a project: MediaWiki-API.
Dbrant added a subscriber: Dbrant.Aug 10 2015, 11:50 AM

...duplicate? T92796

p.s. The Android app has been dealing with index-less search results for a while now, sometimes with amusing results: T104746

Change 230521 had a related patch set uploaded (by DCausse):
Keep 'index' in the result set when resolving redirects

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