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

Hoss Man commented on LUCENE-986:
---------------------------------

i rarely remember a week later what i was thinking when i wrote something, but 
i suspect that when i suggested the DirectoryIndexReader i was assuming it 
would have everything directory/lock related thta currently exists in the 
IndexReader base class (including the directoryOwner boolean) ... in cases 
where there is a single Segment in a directory, there will be SegmentReader 
with directoryOwner==true ... in the multi segment cases, the 
MultiSegmentReader will have directoryOwner==true, and it's sub SegmentReaders 
will all have directoryOwner==false. ...

...the key point of DirectoryIndexReader being that any subclass *can* own a 
directory (and automaticly inherits all the code for dealing with locks 
properly when it needs/wants to) but doesn't always *have* to own the 
directory.  meanwhile MultiReader (and ParallelIndexReader and 
FilteredIndexReader) make no attempt at owning a directory, and inherit no code 
for doing so (or for dealing with the locking of such non existent directories)

I don't really know enough about the performance characteristics of 
SegmentReader vs a MultiSegmentReader of one segment to have a sense of how 
possible/practical it would be to eliminate the need for SegmentReader and 
replace it completely with MultiSegmentReader ... 

one hitch might be that SegmentReader.get is public, and in order to keep 
supporting it, SegmentReader still needs to have/inherit the same segment info 
and directory owning/locking code that we want to move out of IndexReader (so 
just putting it MultiSegmentReader won't fly unless we kill that public method)

> 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
>
>
> 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