The case is, we would like to track separately hitting enter on search box form, and hitting enter while one of suggestion is selected. 

This part of code tracks pressing enter key on search input box, however due to jquery,autocomplete.js:166 (e.stopImmediatePropagation();) code we can probably omit this second condition, I would still stick with it.

Changing event from 'keypress' to 'keydown' was dictated by the "note" part I found here http://api.jquery.com/keypress/ .