Page MenuHomePhabricator

Debounce autocomplete API requests
Closed, ResolvedPublic

Description

Not every keystroke needs to fire an API request to get autocomplete results because, by the time we get the results back, a new character will likely already have been typed, invalidating the results.
Instead, debounce the API requests no keystrokes have been received for a short little time & then fire the API request.

Acceptance criteria:

  • Not every keystroke in the autocomplete field fires an API request when typed fast enough

Event Timeline

Change 650149 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Debounce autocomplete API requests

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

Change 650149 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Debounce autocomplete API requests

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

Etonkovidova subscribed.

Checked in commons wmf.27.

Note: Interesting that separate api requests will be sent even if search terms are pasted in the search field.
e.g. Paste cats dogs rabbits and the result will be

{searchinfo: {search: "cats dogs rabbits"}, search: [], success: 1}
search: []
searchinfo: {search: "cats dogs rabbits"}
success: 1

{searchinfo: {search: "rabbits"},…}
search: [{id: "Q1473406", title: "Q1473406", pageid: 1411413, repository: "wikidata",…},…]
search-continue: 50
searchinfo: {search: "rabbits"}
success: 1

Yeah it does 2 when the term consists out of multiple words:

  • one for the complete term, which should cover the "most likely" next word for a multi-word singular concept (e.g. "united s" will yield "united states ..." suggestions)
  • another for the last word, for additional coverage, because search terms are often a random mixed bag of words (e.g. "green ca" will suggest "green cat" based solely on autocompleting the last word - there is no "green cat" statement)