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

Hoss Man updated LUCENE-986:
----------------------------

    Attachment: lucene-986.patch

I got the patch to apply cleanly (see mailing list for details)  On the whole 
it looks really good, i'm attaching an updated version with some minor 
improvements (mainly javadocs), but first a few questions...

* just to clarify: IndexReader(Directory) is only around for
  backwards compatibility in subclasses right?  And the only reason
  for the "private Directory" is to keep supporting the directory()
  method for any subclasses relying on it?

* IndexReader() says it can be removed once the other constructor is
  removed ... why? is that just pointing out that we can rely on the
  default constructor?

* since one of the goals is that IndexReaders which don't own their
  directory shouldn't utilize segmentInfos, would it make sense to
  eliminate directoryOwner from DirectoryIndexReader and instead test
  whether (null == segmentInfos) ?

* the way TestMultiReader is setup with the "mode" is a bit confusing
  ... perhaps instead we should make a subclass where only openReader
  is overwritten (it will inherit the individual test methods) ?



here's the list of tweaks I made...

* added a note in the IndexReader class javadocs about
  methods that throw UnSupOp but aren't abstract.
* added javadocs to the IndexReader(Directory) constructor based on my 
  understanding
* added back javadocs to IndexReader methods that now throw UnSupOp to
  make it clear what they do to callers looking at the API, but made
  it clear tthe default impls throw UnSupOp
* made IndexReader.directory() throw UnSupOp if directory is null,
  enhanced it's javadocs.
* /* NOOP */ in IndexReader.acquireWriteLock so it's clear to code analysis 
tools that it's not a mistake.
* small additions to javadocs for DirectoryIndexReader class, but
  these should probably be elaborated on (depending on what you think
  of my segmentInfos==null idea above)
* made DirectoryIndexReader(...) call init(...) to eliminate a small
  about of duplication.


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