Use a single instance of IndexSearcher. When you detect that the index has changed, through that instance (see javadoc for the exact method name, I don't recall its exact name now), discard that instance, and make a new one. Do this check before every query or every X <unit of time> if you don't care about the newest index entries appearing in search results immediately.
Otis --- Maurice Coyle <[EMAIL PROTECTED]> wrote: > hi all, > i have a fairly big index (relative to the computing power at my > disposal), > which takes a little too long for my liking to open if i run a lot of > queries through it in sequence. i've worked out that the bottleneck > is the > opening of the index since when i run the queries through a much > smaller > index they run much faster. > > so in my code i have a single IndexSearcher object which i re-use to > perform > each search (with a different Query each time). i've decuded from > the > archives that this is ok, i.e. it's safe to re-use an IndexSearcher > object. > > what i was wondering was whether i should proceed as i am, i.e. > reusing an > IndexSearcher object which is created at the start of my program, or > at the > beginning of my program open an IndexReader object which will be > passed to > the constructor of a new IndexSearcher object for each query. > > or to put it simply, are both solutions as effective/efficient as > each > other? > > thanks, > maurice > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
