lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Goller <gol...@detego-software.de>
Subject Re: MultiReader
Date Fri, 02 Apr 2004 17:30:19 GMT
Doug Cutting wrote:
> So, to implement this we might:
> 
> 1. Remove the writeLock, segmentInfos and doDelete() from IndexReader.
directory should also be removed. It should go into SegmentReader and 
SegmentsReader. close() would also become abstract.
> 
> 2. Change IndexReader.delete() to be abstract.
> 
> 3. Rename MultiReader.doDelete() to delete(), so that 
> MultiReader.delete() simply delegates to all sub-indexes.
> 
> 4. Define SegmentReader.delete() to perform version checking and 
> locking, then call the protected method doDelete().
> 
> 5. Define SegmentsReader as a package-private subclass of MultiReader. 
> It requires each of its sub-indexes to be a SegmentReader.  It overrides 
> the delete() method to check versions, lock the directory, then call 
> doDelete() on each sub-index.
> 
> What do you think?

Looks like a very good design. The only thing I don´t like is that version
checking and locking in delete() is implementeed twice in SegmentReader and
SegmentsReader. However, I don´t see another solution since multiple inheritence
is not possible in Java and SegmentsReader should definitely extend MultiReader.
Maybe version checking and locking should be implemented in an additional class
used by SegmentReader and SegmentsReader.

I accidentely stumbled over this one: Shouldn´t we obtain a write lock for 
setNorm too?

If you agree, I could try to do the proposed implementation in the next few 
days. What do you think?

Christoph


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message