If I where going to do this I would create special autocomplete index. I would add each name that I wanted to be able to autocomplete on to this index. You can tokenize if you want (the lowercase filter) but do not use something that will split up words...you want "Appleton Bakery Café" to go in as a single token. If you find a term already in the index, you can reindex it with a higher boost to affect ordering in the suggestions. You certainly do want to store (to retrieve the suggestions using the prefix query), you don't need Term Vectors, and I see no reason to use the KeywordAnalyzer (you want apple to match Apple).
- Mark On 5/4/07, Max Metral <[EMAIL PROTECTED]> wrote:
Hi. I'm trying to design a proper index and query mechanism for looking up a business listing using an Ajax-style autocompleting text box. While I have gotten "versions" to work, I'm wondering what the optimal approach is. Someone may be looking for "Appleton Café." That listing might be under "Appleton Café and Bakery", or "Appleton Bakery Café" etc etc. When they type "apple" I want to match it (easy), and when they type "Appleton ca" I want to match it also. I'm taking a simple attempt now, which is just a PrefixQuery. Problem is I seem to need to Store it, Tokenize it (KeywordAnalyzer), and store the Term Vector just to get the PrefixQuery to work. Is this true? Since I already have the "title" field stored using a Snowball analyzer in another field, I want the minimum bits required to make the PrefixQuery work to be stored in the index. Thanks very much for any pointers, --Max