Hi,

I just have a suggestion to your first idea of enumerating terms, which is
very fast if done right:

> I'd like to suggest search terms to my users. My naïve approach would have
> been:
> After at least n characters have been typed (asynchronously) find terms in
> IndexReader.terms()  which "match"

Much easier is to use IR.terms() but wrap a PrefixTermEnum around it (it's
in search package). Then you simply iterate (please don't forget that the
enum is already positioned on the first term!!! If no such term exists, the
enum's term() returns null). Just use a "if (enum.term() != null) do { }
while (enum.next()!=null && numberOfTermCollectex <= max)", with Lucene
trunk this is much better now, but with 3.x, you have to use this ugly
iteration.

Uwe


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to