Skip to content
Snippets Groups Projects
Forked from The Tor Project / Applications / Tor Browser
Source project has a limited visibility.
user avatar
Drew Willcoxon authored
This implements the new required matching behavior, which isn't based on min
keyword length anymore. This is how it works:

* Use the full keywords in remote settings to generate keywords that contain the
  first word plus each possible substring after the first word. For example if a
  full keyword is "video download", then generate these keywords: "video",
  "video ", "video d", "video do", etc. If a full keyword is only one word, then
  use it as is. The keywords never change even when the user clicks "Show less
  frequently". This is implemented in `onRemoteSettingsSync()`, and I modified
  `SuggestionsMap.add()` to make it easy to generate new keywords from the
  strings in `suggestion.keywords`.
* Keep track of the number of times the user clicked "Show less frequently" in
  `showLessFrequentlyCount`.
* When a suggestion is fetched from the suggestions map, filter it out if the
  search string isn't long enough given the `showLessFrequentlyCount`. This is
  done in `makeResult()`.

Other changes:

* I made some of the private properties in `AddonSuggestions` public so that the
  xpcshell test can easily use them. I think it's OK for them to be public.
* Added `show_less_frequently_cap` to the RS config object so that we can
  specify a cap in RS as well as Nimbus.
* mv'ed test_quicksuggest_addResults.js to test_suggestionsMap.js, since I
  modified this file. I should have done that back when I replaced `addResults()`
  with `SuggestionsMap`.
* Fixed a bug in `SuggestionsMap.add()` where the same suggestion could be added
  multiple times to the array stored in the map, if it had duplicate keywords.

Differential Revision: https://phabricator.services.mozilla.com/D179867
5dd32385
History
Name Last commit Last update