Tweak the 'AwesomeBar''s Suggestion Algorithm

Firefox 3's Smart Location bar suggests URLs as you type based on an algorithm that combines both how often you've visited a web site before, and whether you've got it bookmarked. A combination of frequency and recency of visits, the Mozilla developers call the "AwesomeBar"'s suggestion algorithm "frecency"—but it's not set in stone or hidden away somewhere. In fact, the weight of each attribute is set inside your Firefox's about:config area. Let's take a look where they are, and how to adjust them.

The MozillaZine Knowledgebase explains:

Firefox takes into account how frequently and how recently sites in the browser history were visited, combining them into a statistic called "frecency." The frecency of sites is calculated when the browser is idle. The way frecency is computed can be tweaked by a number of preferences.

The means by which a user arrived at a given URL (the "transition type") is taken into account when calculating frecency. Typing in a URL, for example, is given a higher "bonus" than visiting a bookmark or clicking a link. These preferences—of the form places.frecency.(visit type)VisitBonus—determine the various bonus percentages given to the defined transition types.

Here are the frecency types and the percent bonus given to their particular type (default values listed here.)

places.frecency.linkVisitBonus 100
places.frecency.typedVisitBonus 2000
places.frecency.bookmarkVisitBonus 150
places.frecency.embedVisitBonus 0
places.frecency.downloadVisitBonus 0
places.frecency.permRedirectVisitBonus 0
places.frecency.tempRedirectVisitBonus 0

These bonus values, combined with a set of "buckets" that define visit time periods—the first bucket is 4 days, the second 14, the third 31—combine frequency and recency to calculate a score that determines a suggestion's rank.

Want to see the math? Here's an example, from the Mozilla Developer Center:

For most users the default values should suffice, but if you want to make your bookmarks rank higher, for example, lower places.frecency.bookmarkVisitBonus's default 150 number and see how it affects your results.

Warning: We haven't tested adjustments to these numbers and their effects extensively, so double-check your defaults, proceed with caution, tweak and test, then repeat to get the Smart Location Bar to rank URL types to your liking. Thanks, USBman!


Be the first to comment on this story!