You are here

Improved Form History

Autocomplete dropdown sorted by frecencyMy first project this summer as an intern at Mozilla on the Firefox team was to improve the form history feature. It's a feature that most people use when they fill out forms but don't even realize it. For those of you who don't know what I'm talking about, it's the dropdown of previously submitted text that appears when typing into a form input field. The two main improvements that I have been working on in form history (which are also known as form awesomecomplete) for Firefox 3.6 are detailed below.

Frecency Sort

For the longest time, the entries in the dropdown were sorted alphabetically, which is fine with a small number of results. When you have many saved entries that match what you've typed, an alphabetical sort doesn't help you find the ones that you are likely to use again, since ones that you use regularly are mixed in with the others you've only used once. To make the order of results more useful and reduce the number of keypresses required to select a previous entry, I have implemented a frecency calculation to rank the results. Frecency is a concept that was introduced in Firefox 3 with the "Awesomebar", Firefox's smart address bar. The term is derived from the combination of frequency and recency whereby the more often or the more recently you’ve used the entry, the higher it ranks. Since the most relevant entries will now be at the top of the list of results, this should reduce the number of keypresses to select the entries that you use most often.

Substring Matches

Autocomplete search dropdown with substring matchingSometimes when filling out a form or typing search terms in the search bar, you may remember only a portion of the text that you previously submitted and you want to retrieve again. An example of this is when you want to repeat a previous search from the search bar such as one for "location". In the past, only previous entries that started with the text "location" would be displayed, and so you would not see a previous search for "firefox 3.5 geolocation". With my improvements, any text that you previously entered which contains the typed text anywhere in the entry will be displayed. Consider another example: if you don't remember your friend's entire email address when filling out a form but you happen to remember that you filled it out in this form before and they have a Mozilla address. Simply enter "@mozilla" in the text field and all email addresses for that field that contain "@mozilla" (ie. or will be displayed. Bonuses are given to matches that are at the beginning of a word or if they are exact prefix matches (like the previous method) so that irrelevant results that happen to contain the search text shouldn't get in the way of relevant results. This should make finding past entries easier as you don't have to type the exact prefix.

For more information on the frecency algorithm used and some preferences to tweak the results, see the wiki page. Feel free to experiment with these features and the associated preferences and file bugs in Toolkit::Form Manager.


And of course, we've learned from the reception to the awesome bar that this feature will be able to be COMPLETELY turned off with a single pref and checkbox in the options dialog, haven't we?

Yay! It's great this got in for 3.6!

Making my life easier, one form at a time! Nice work.

Wow, I've been hoping for this for some time! Great work!!


And how do I disable this 'intelligent sorting and get back the alphabetical sorting I had before?! Please!

If you would like the results to be ordered alphabetically, set browser.formfill.bucketSize to a large value such as 999999999 in about:config. You could also just increase the number slightly if you still like the ordering by frecency but prefer that entries with a similar frecency score are grouped together and sorted alphabetically within the bucket.

And how do we turn this off?

Is there any way to disable this new feature :(

I liked the previous alphabetical sorting.

I fought like the dickens to get the Awful Awesome Bar tamed, now the Autofill has been infected.

It would be nice if it could be turned off or if there was some kind of guide for how to set about:config parameters to get what I want. But, no, no such thing.

I'm not upgrading from 3.5 Firefox. This irritation just isn't worth it. Sorry Matthew.

It took me weeks to find the workaround that required me, just a normal user not an expert, to delve into about:config, which I had never even heard of, to get dates to sort in date order. But forms are used in many ways and no one solution will satisfy everybody.

Your assumption that people do not need alphabetical sort is bogus. Because it also includes loss of the numerical sort -- and I will not go through an entire form list looking for a part number "at random" or based on the frequency that the part number was entered in the past. This has reduced my productivity considerably and I assume it will do so for my employees as well. I will recommend that we revert to 3.5.x on Monday unless there is a legacy feature in the config that can be turned on. I am reverting now. Hope someone is mentoring interns there.

Firefox was meant to be a simple, user friendly browser. Things like this random sorting of autocomplete entries make it actively user-hostile. The browser.formfill.bucketSize set to a high value works, but WHY should this be necessary?

Say you have a form used for data entry, with a text input box into which you've previously entered lots of different text, including "Designer", "Set designer", "Lighting designer", "Associate director", "Front of house leader", "Assistant designer". When your data entry person wants to enter "Designer", they previously could just start typing "D", perhaps "De", and it'd be there. Now, they get all the different things that happen to have "de" in it no matter where they are, in an order that changes depending on what they've been doing recently [1], and it is more work to locate and select Designer, not less, although they knew exactly what they wanted. This behaviour is great in the URL bar, but is very much unwanted in form history auto-complete.

[1] The comment above to alter browser.formfill.bucketSize can fix the changing ordering of results at least, but doesn't fix that it's not prefix-only any more. Is there any config variable we can alter to change that? Or otherwise it looks like another 3.5 rollback here, I'm afraid. If there was simply a config variable to select which behaviour was preferred, that would be great.

After finding and reading the documentation at and playing around with the config variables more, it seems that if you don't change bucketSize (so set that back to 1), but instead change *prefixWeight* to a very high number instead, then (understandably) the prefix ones appear first with the others underneath (in who knows what order). If there are multiple entries with the same prefix, I'm not sure what order they'll be in, but this is at least a more workable solution, and hopefully might be helpful to others out there in the same position.