Page MenuHomePhabricator

[bug] items appear twice in search suggester dropdown after duplicate API request
Closed, DuplicatePublic

Description

I am seeing items twice in wikidata.org's search suggester drop-down.
In a new Firefox private window, visit https://www.wikidata.org/wiki/Special:Random, click in the search box, and type "Padma Sa".
Most of the time duplicate results appear in the dropdown list of suggestions under the search field:

Wikidata doubled search suggestions bug.png (566×580 px, 40 KB)

Watching the network traffic in the development console, there are two identical API requests for action=wbsearchentities of "Padma", then two identical requests for "Padma S" and then two identical searches for "Padma Sa":

https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Padma+Sa&format=json&language=en&type=item&continue=0

once there are few enough results, you see the results from the second API request appended in the search suggester dropdown.

This also happens when I type "Albert Ein", I get two sets of 6 results returned, and the search dropdown combines them. Yet sometimes I only see one API request and the search dropdown shows unique matches, until I type more or backspace. If I paste a search string it seems there's reliably only one request. Maybe overlapping key and change events are causing this.
I haven't looked at the code, but the duplicate API requests might be revealing some search results API issues:

  • consider aborting API requests in flight if a new request obsoletes them.
  • don't make the same API request twice
  • also don't specify a misleading "falsy" value with continue=0, just continue= is fine

This sounds much like T109697: [Bug] suggestions show up twice in entity suggester, but happening in a different place.

Event Timeline

Spage raised the priority of this task from to Needs Triage.
Spage updated the task description. (Show Details)
Spage added a project: Wikidata.
Spage added a subscriber: Spage.