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

Hoss Man commented on LUCENE-743:
---------------------------------


> Yeah we could do that. However, this might not be so easy to implement.
> For example, if a user creates a MultiReader instance and adds whatever
> subreaders, we would have to recursively refresh the underlying readers.
> But if the MultiReader was created automatically by IndexReader.open() just
> calling refresh on the subreaders is not enough. New SegmentReaders have to
> be opened for new segments. 

...this being the curse that is MultiReader -- it can serve two very differenet 
purposes.  

You seem to have already solved the multisegments in a single directory 
approach, the MultiReader over many subreader part actually seems much easier 
to me (just call your open method on all of the subreaders) the only tricky 
part is detecting which behavior should be used when. This could be driven by a 
simple boolean property of MultiReader indicating whether it owns it's 
directory and we need to look for new segments or not -- in which case we just 
need to refresh the subreaders.  (My personal preference would be to change 
MultiReader so "this.directory" is null if it was open over several other 
subReaders, right now it's just assigned to the first one arbitrarily, but 
there may be other consequences of changing that)

Incidentally: I don't think it's crucial that this be done as a recursive 
method.  the same approach i describe could be added to  static utility like 
what you've got, I just think that if it's possible to do it recursively we 
should so that  *if* someone does write their own MultiReader or SegmentReader 
subclass they can still benefit from any core reopening logic as long as theey 
do their part to "reopen" their extensions.


> IndexReader.reopen()
> --------------------
>
>                 Key: LUCENE-743
>                 URL: https://issues.apache.org/jira/browse/LUCENE-743
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Otis Gospodnetic
>            Assignee: Michael Busch
>            Priority: Minor
>         Attachments: IndexReaderUtils.java, lucene-743.patch, 
> MyMultiReader.java, MySegmentReader.java
>
>
> This is Robert Engels' implementation of IndexReader.reopen() functionality, 
> as a set of 3 new classes (this was easier for him to implement, but should 
> probably be folded into the core, if this looks good).

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