lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <>
Subject Re: best way of reusing IndexSearcher objects
Date Wed, 05 Nov 2003 19:12:54 GMT
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


--- Maurice Coyle <> 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:
> For additional commands, e-mail:

Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

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

View raw message