8 jun 2007 kl. 03.31 skrev Chris Lu:

Hi,

I would like to implement an AJAX search. Basically when user types in
several characters,  I will try to search the Lucene index and found
all possible matching items.

Seems I need to use wildcard query like "test*" to matching anything.
Is this the only way to do it? It doesn't seems quite efficient,
especially when you just typed in the first character.

I guess the "good" way is to go through the terms, and return as soon
as, for example, 10 terms are found.

I am wondering is there anything like this already built?

The simplest solution is to tokenize your index and queries as ngrams. However, it can turn out to be quite expensive to bash the index with 2-10 times as many queries as it is used to. If you have a really busy system, try to reduce the auto-complete corpus to what is popular.

LUCENE-625 is a solution that use a trie-pattern rather than Lucene. It learn and adapt on user behavior. I.e. it require user activity. But if you have that, this is what I recommend for a speedy auto- complete.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to