I would really appreciate any input you can give me on how to accomplish this in a production environment. Let me try to be more clear on what I want to do.
I have a database of about 500,000 businesses. They are all geocoded for lat/lng searches based on the map area that the user is searching. When they are searching for businesses in their search area, I would like to present them with a list of the first 10 results based on cumulative keystrokes as they type.
So if they start typing and the first letter is 'e', I will do an ajax request to search for the first 10 distinct names that start with 'e'. If the next letter is 'a' I will do the search for the first 10 distinct names that start with 'ea' and so on, narrowing the list each time until they name they are looking for shows up at which time they can select it.
At first, when I just let it run, it seemed to "lock up", in other words the js keyup event would stop firing for some reason. Since I have put in the setTimeout that has stopped happening for whatever reason. I understand it could just be coincendental but it seems to work.
Again, any help regarding the best way to do this would be greatly appreciated.