[ https://issues.apache.org/jira/browse/LUCENE-743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532833 ]
Michael Busch commented on LUCENE-743: -------------------------------------- > why use clones at all? why not just use the original reader (if the "index" > that reader represents hasn't changed, why clone it? Let's say you have a MultiReader with two subreaders: {code:java} IndexReader ir1 = IndexReader.open(index1); IndexReader ir2 = IndexReader.open(index2); IndexReader mr = new MultiReader(new IndexReader[] {ir1, ir2}); {code} Now index1 changes and you reopen the MultiReader and keep the old one open: {code:java} IndexReader mr2 = mr.reopen(); {code} ir1 would now be reopened and let's assume we wouldn't clone ir2. If you use mr2 now to e.g. delete a doc and that doc happens to be in index2, then mr1 would also see the changes because both MultiReaders share the same subreader ir2 and are thus not independent from each other. > why not make reopen always return this.clone() clone() might be an expensive operation. We only need to clone if at least one of the subreaders has changed. > 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 > Fix For: 2.3 > > Attachments: IndexReaderUtils.java, lucene-743-take2.patch, > lucene-743.patch, lucene-743.patch, 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]