* Generates the value of the `wprov` parameter to be used in the URL of a search result and the
* `wprov` hidden input.
*
* See https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/WikimediaEvents/+/refs/heads/master/modules/ext.wikimediaEvents/searchSatisfaction.js
* and also the top of that file for additional detail about the shape of the parameter.
*
* @param {number} index
* @return {string}
*/
functiongetWprovFromResultIndex(index){
// result looks like: acrw1_0, acrw1_1, acrw1_2, etc.;
// or acrw1_-1 for index -1 (user did not highlight an autocomplete result)
return'acrw1_'+index;
}
/**
* @typedef {Object} SearchResultPartial
* @property {string} title
* @property {string} [url]
*/
/**
* Return a new list of search results,
* with the `wprov` parameter added to each result's url (if any).
*
* @param {SearchResultPartial[]} results Not modified.
* @param {number} offset Offset to add to the index of each result.