lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doron Cohen <>
Subject Re: multireader vs multisearcher
Date Sun, 02 Dec 2007 22:18:54 GMT
MultiReader is more efficient and is preferred when possible.
MultiSearcher allows further functionality.

Every time an index has more than a single segment (which is.
to say almost every index except for after calling optimize()),
Opening an IndexReader (or an IndexSearcher) above that index),
is actually using a MultiReader, each reader actually is a
SegmentReader. So MultiReader is a basic "tool" for
accessing a multi-segment index.

MultiSearcher is more geared for situations where an
application maintains several separate indexes, and needs
to allow searching all (or some) of them. They may reside in
separate machines. The specific Searcher implementation
to access some of them may be Web based. Still, MultiSearcher),
allows to search all of them with a single search() call.

"John Wang" <> wrote on 01/12/2007 21:48:38:

> Hi:
>    What is the difference between using:
> 1) MultiReader reader=....; // create multi reader from different indexes
>     IndexSearcher searcher=new IndexSearcher(reader);
> vs.
> 2) IndexSearcher searcher1=...
>     IndexSearcher searcher 2=..
>     MultiSearcher searcher=new MultiSearcher(new
> IndexSearcher[]{searcher1,searcher});
> I understand there are some differences with idf fixing etc.,
> but seems to
> me the api is presenting two ways of solving a problem with slightly
> different results.
> Thanks
> -John

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

View raw message