Search + Ajax = MXNA Suggest

I’m experimenting with making the MXNA search more useful, so I decided to borrow some ideas from Google and build MXNA Suggest. MXNA Suggest lets you search interactively by suggesting terms that other people have searched for in the past as you type. The terms MXNA Suggest returns are ordered by relevance, which is determined by the number of times people have searched for them. In addition to being a potentially useful search interface, it’s also an interesting research tool. It’s sort of a quick and even fun way to see what terms are most popular in the Macromedia community.

MXNA Suggest is still very much in an "alpha" stage which means I’ve just been hacking away at it in my free time, and therefore it has not been thoroughly tested. That said, it does seem to work pretty well, although it took a lot of work to get it that way. I’m a big Ajax/JavaScript fan, but it can get very frustrating when developing across browsers and platforms (even with all the most modern browsers). If you view the source code, you’ll see areas where I had to branch based on browser, and if you use it enough, you might even find a bug or two I haven’t fixed yet (for instance, in Safari, hitting the up and down arrow will make the selection jump two items at a time instead of one because Safari throws two key down events for the arrow keys for some reason I couldn’t possibly begin to explain).

The other difficult part of this project was basically building my own component in JavaScript. I’m using a standard HTML text input for the search term, but everything below that is custom built. Getting things like the auto-complete and the selection behavior to work like you’d expect, and getting it to work across browsers and platforms, was not easy.

But of course I love these types of challenges, so I’m not complaining. I’ve been dealing with cross browser issues since I first got into web development (many years ago), and at least in the realm of JavaScript and DHTML, it looks like they aren’t going away any time soon.

Anyway, feel free to view the source and swipe some code if you can use it. It isn’t documented, but it’s pretty clearly written, so it should be easy enough to follow. And if you find any bugs, post them here, and I’ll try to get them fixed. If this proves a useful feature, maybe eventually I’ll move it out of the "experimental" directory and integrate it with the main application.