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

Michael Busch updated LUCENE-743:
---------------------------------

    Attachment: lucene-743.patch

First version of my patch:

   * Adds the static method IndexReader.open(IndexReader)
     that returns a new instance of IndexReader in case
     the reader could be updated. If it was up to date
     then the passed-in instance is returned. Only
     IndexReader instances that were created by one of
     the IndexReader.open() methods can be refreshed.

   * SegmentsReader.reopen(SegmentInfos) looks in the 
     SegmentInfos for a segment with the same name. If
     one could be found then either the deleted docs or
     the norms were updated, otherwise the segment name
     would have changed. reopen() clones the 
     SegmentReader and either loads the deleted docs,
     the norms or both. Then the clone is returned and
     the original SegmentReader is marked as closed.

   * If the index has only one segment, then 
     IndexReader.open(IndexReader) checks if the passed
     in IndexReader can be refreshed. This is only 
     possible if it is no MultiReader and if the segment
     name has not changed. Otherwise a new SegmentReader
     instance is returned and the old reader is closed.
         
   * If the index has multiple segments, then
     IndexReader.open(IndexReader) creates a new 
     MultiReader and tries to reuse the passed-in
     reader (in case it's a SegmentReader) or its 
     subreaders (in case it's a MultiReader). For new
     segments new SegmentReaders are created. Old 
     readers that couldn't be reused are closed.
   
   * Adds the new testcase TestIndexReaderReopen. It
     includes the method 
     assertIndexEquals(IndexReader, IndexReader) that
     checks whether boths IndexReaders have the same
     content. The testcase creates an index and 
     performes different modifications on that index.
     One IndexReader is refreshed after each index
     modification and compared to a fresh IndexReader
     which is opened after each modification.
         

This first version is for review and not ready to 
commit. I want to add more extensive tests and 
probably clean up the code.

All tests pass.

> 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