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

Michael McCandless commented on LUCENE-1637:
--------------------------------------------

Couldn't you simply call IW.getReader() just after calling IW.commit()?

Or just IndexReader.reopen?  (The extra work that reopen does vs 
IndexWriter.getReader is fairly minor -- the former must find & open the 
segments_N file; after that it's the same).

> Getting an IndexReader from a committed IndexWriter
> ---------------------------------------------------
>
>                 Key: LUCENE-1637
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1637
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>    Affects Versions: 2.9
>            Reporter: Shay Banon
>
> I just had a look at the job done in IndexWriter in order to get an 
> IndexReader with all the current ongoing changes done using the IndexWriter. 
> This feature is very useful, and I was wondering if another feature, which (I 
> think) is simple to implement (compared to the previous one) might make 
> sense. 
>    Many times, an application opens an IndexWriter, does whatever changes it 
> does, and then commits the changes. It would be nice to get an IndexReader 
> (read only one is fine) that corresponds to the committed (or even closed) 
> IndexWriter. This will allow for a cache of IndexReader that is already used 
> to be updated with a fresh IndexReader, without the need to reopen one (which 
> should be slower than opening one based on the IndexWriter information). The 
> main difference is the fact that the mentioned IndexReader could still be 
> reopened without the need to throw an AlreadyClosedException. 
>    More information can be found here: 
> http://www.nabble.com/Getting-an-IndexReader-from-a-committed-IndexWriter-td23551978.html

-- 
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: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to