lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Grant Ingersoll" <>
Subject Re: How to navigate through indexed terms
Date Wed, 25 May 2005 12:51:51 GMT
This isn't totally what you want, but is a intermediate step between
going through all terms is something like what is in Luke.  

In Luke on the Documents tab, you can put in a single letter in the
Browse by term field and then hit "next term" and it will give you the
next term, which you could then use to get at your term range much more

So, you could build your iterator by seeking to the first term that
starts with the letter of your central term, and then iterate from there
to find your central term, keeping a stack of the last ten items.

Not sure on the functionality required, but you could look in the Luke
code (or maybe Luke's author could share).  I am guessing it has to do
with the seek functionality.

Of course, you could also add a previous() method into the source and
submit the patch, as the code would be very similar to the next()
functionality, I think.

>>> 5/25/2005 4:01:08 AM >>>

I am currently looking for a way to navigate forward and backward among

the indexed terms.
For example, given a Term t, I would like to be able to get the next 10

terms or the previous 10 ones.

Getting the next terms is quite straitforward, using the terms(Term t)

method from IndexReader. The problem arises when I try to get the 
previous terms. Since the TermEnum returned by IndexReader.terms(t)
has a next() method, I had to get all the terms from the index and 
iterate through them up to the given term. It it not a good method and

it will probably be very slow whith big indexes...

Has anyone ran through this problem yet?


                Antoine  Brun

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

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

View raw message