[ 
https://issues.apache.org/jira/browse/LUCENE-1314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12655332#action_12655332
 ] 

Jason Rutherglen commented on LUCENE-1314:
------------------------------------------

Seems like 2 solutions to clone and pending updates in SegmentReader:

1) Flush any pending changes on clone
2) Throw an exception when the original SegmentReader receives new updates 
(i.e. deleteDocument is called) and on close does not flush the changes.  Flush 
throws an exception reading "This segmentreader has pending changes and has 
been cloned and so cannot accept or flush updates"  The problem with this one 
is it could lead to unpredictable behavior in that the user may assume the 
pending changes are being flushed (on close) and are not.  

Perhaps both can be supported with IndexReader.clone(boolean autoFlush) where 
the autoFlush=true tells the clone method to flush pending updates (if there 
are any), and false means keep the pending changes but throw an exception on 
flush.

> IndexReader.clone
> -----------------
>
>                 Key: LUCENE-1314
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1314
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Index
>    Affects Versions: 2.3.1
>            Reporter: Jason Rutherglen
>            Assignee: Michael McCandless
>            Priority: Minor
>         Attachments: lucene-1314.patch, lucene-1314.patch, lucene-1314.patch, 
> lucene-1314.patch, lucene-1314.patch, lucene-1314.patch, lucene-1314.patch, 
> lucene-1314.patch, lucene-1314.patch, lucene-1314.patch, lucene-1314.patch, 
> lucene-1314.patch
>
>
> Based on discussion 
> http://www.nabble.com/IndexReader.reopen-issue-td18070256.html.  The problem 
> is reopen returns the same reader if there are no changes, so if docs are 
> deleted from the new reader, they are also reflected in the previous reader 
> which is not always desired behavior.

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