[ 
https://issues.apache.org/jira/browse/LUCENE-986?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Busch updated LUCENE-986:
---------------------------------

    Attachment: lucene-986.patch

Here is the patch with the DirectoryIndexReader approach.

It moves SegmentInfos and Directory from IndexReader into
DirectoryIndexReader, as well as the commit and rollback logic.

MultiSegmentReader and SegmentReader extend DirectoryIndexReader. 
MultiReader extends IndexReader now and uses some methods from 
MultiSegmentReader that I made static.

I added the method acquireWriteLock() to IndexReader that does 
nothing by default. Subclasses must implement it if they require 
a write lock (so does DirectoryIndexReader now).

IndexReader is very abstract now and almost all logic moved into
the subclasses. The methods isOptimized(), isCurrent(), and 
getVersion() all throw an UnsupportedOperationException (UOE). I 
further deprecated the IndexReader constructor that takes a
Directory as argument. As soon as we remove this ctr the method
IndexReader.getDirectory() should throw an UOE as well. I added
a TODO comment as a reminder.

All unit tests pass with this patch.

> Refactor segmentInfos from IndexReader into its subclasses
> ----------------------------------------------------------
>
>                 Key: LUCENE-986
>                 URL: https://issues.apache.org/jira/browse/LUCENE-986
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Michael Busch
>            Assignee: Michael Busch
>            Priority: Minor
>             Fix For: 2.3
>
>         Attachments: lucene-986.patch
>
>
> References to segmentInfos in IndexReader cause different kinds of problems
> for subclasses of IndexReader, like e. g. MultiReader.
> Only subclasses of IndexReader that own the index directory, namely 
> SegmentReader and MultiSegmentReader, should have a SegmentInfos object
> and be able to access it.
> Further information:
> http://www.gossamer-threads.com/lists/lucene/java-dev/51808
> http://www.gossamer-threads.com/lists/lucene/java-user/52460
> A part of the refactoring work was already done in LUCENE-781

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to