Marvin Humphrey <mar...@rectangular.com> wrote:
> On Wed, Mar 25, 2009 at 06:15:35AM -0400, Michael McCandless wrote:
>
>> I'm torn.  MergePolicy (and MergeScheduler) are "expected" to be
>> something expert users could alter; their API is designed to be
>> exposed & stable.  I think they should be visilbe in the javadocs.
>>
>> But, unfortunately, to do their job they must use other package
>> private APIs (SegmentInfos) which we intentionally would like to keep
>> more malleable.
>
> Is all the information that you'd need to perform the merge available via
> public methods on IndexReader and its descendants?  Does IndexWriter always
> have an IndexReader at its disposal yet?  And if the answer to those two
> questions is yes, can you refactor MergePolicy to work off of an IndexReader
> rather than a SegmentInfos?

Good idea...

We'd need to add a few methods to IndexReader, eg querying whether
compound file format is in use, whether separate norms are stored,
"get me total size in bytes of all files" (or maybe just "get me all
files", plus utility method somewhere to add up the sizes), so this
approach seems doable.

But: we don't yet have IndexWriter holding open a reader for every
segment.  We are working on realtime search (LUCENE-1516), but even
then, if you don't ask for a realtime reader from IndexWriter, it
won't hold open SegmentReaders for all segments.

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to