How to navigate through indexed terms

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to navigate through indexed terms

Antoine Brun
Hello,

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) only
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?

Thanks,

           
                Antoine  Brun

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to navigate through indexed terms

Grant Ingersoll
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
quickly.

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.

>>> [hidden email] 5/25/2005 4:01:08 AM >>>
Hello,

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)
only
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?

Thanks,

           
                Antoine  Brun

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to navigate through indexed terms

Antoine Brun
Hi,

thanks for the hint.
I guess that the best solution would be to implement a previous() method.
I was wondering if anyone has ever planned on doing this?

Antoine Brun

>
>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.
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]