lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <>
Subject RE: Need help regarding implementation of autosuggest using jquery
Date Wed, 25 Nov 2009 09:54:43 GMT
Hi Dhivya,

you can iterate all terms in the index using a TermEnum, that can be
retrieved using IndexReader.terms(Term startTerm).

If you are interested in all terms from a specific field, position the
TermEnum on the first possible term in this field ("") and iterate until the
field name changes. As terms in the TermEnum are first ordered by field name
then by term text (in UTF-16 order), the loop would look like this:

IndexReader reader = ...
String field = ....
Field = field.intern(); // important for the while loop
TermEnum tenum = reader.terms(new Term(field,""));
try {
	do {
		final Term term = tenum.term();
		if (term==null || term.field()!=field) break;
		final String termText = term.text();
		// do something with the termText
	} while (;
} finally {

Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen

> -----Original Message-----
> From: DHIVYA M []
> Sent: Wednesday, November 25, 2009 8:06 AM
> To: java user
> Subject: Need help regarding implementation of autosuggest using jquery
> Hi all,
> Am using lucene 2.3.2 as a search engine in my e-paper site. So that i
> want the user to search the news. I achieved that objective but now am
> trying to implement autosuggest so that user can pick a choice from the
> drop down and no need of typing in the entire sentence or so.
> I have download Jquery for this purposeĀ and am trying to implement it.
> The collections of data to refer for the suggestion is given in an
> arraylist or jus with in a string.
> But for my application, i need to populate the suggestions with the
> indexed words available in the index file created during indexing
> operation.
> Can anyone give an idea to read the contents from the index file and make
> it available as suggestions? or anyother idea to achieve this objective?
> Thanks in advance,
> Dhivya
>       The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message