[email protected]
[Top] [All Lists]

MultiSearcher vs MultiReader

Subject: MultiSearcher vs MultiReader
From: Kirk Roberts
Date: Tue, 17 Apr 2007 13:48:43 -0500
I've been on this list long enough to have a vast repository of information about using a MultiSearcher versus an IndexSearcher that works on a MultiReader. However, after looking through several hundred list postings, I could not find what I was looking for. So if there is a posting or thread (or website, for that matter) that answers all my questions, please direct me there and, if so, I apologize in advance.

From what I have read, people seem to suggest using an IndexSearcher initialized with a MultiReader over the use of a MultiSearcher. This begs 2 questions:
1. Under what conditions is a MultiSearcher necessary/optimal?
2. Why doesn't the MultiReader implement the rather nice methods that the MultiSearcher has (I'm thinking specifically of subSearcher(int) and subDoc(int))?

Right now my application uses the MultiSearcher because I need to know the original (single) index the document came from as well as the Lucene document ID within that index (so I don't have to hold on to the entire Lucene Document). I can calculate both if I get the size of all the individual readers, and assume that the ID a MultiReader returns equals the original IndexReader's given ID plus the size of every IndexReader that precedes it (eg, if I have 3 indexes each of size 10, the Document that the MultiReader gives an ID of 23 to will be the 3rd Document in the 3rd IndexReader). This might be safe (and indeed might be exactly what the MultiSearcher does), but I haven't dug into the Lucene code much to find out.

Currently I'm leaning to switching to a MultiReader, as performance is more important than having to write some extra code. I'm just a little confused as to 1) why the MultiSearcher exists (as I can't seem to find decent documentation) and 2) how safe my above algorithm is (or if I've just completely missed existing functionality that does this).

Links to any detailed documentation would be greatly appreciated,


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

<Prev in Thread] Current Thread [Next in Thread>