lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Whelan <phil...@gmail.com>
Subject Re: Problems with IndexReader.reopen()
Date Mon, 14 Sep 2009 22:25:27 GMT
Sorry, just realised my mistake. I should read the docs more
carefully. IndexReader.reopen() does not reopen the existing
IndexReader, but returns a new one.

Phil

On Mon, Sep 14, 2009 at 3:20 PM, Phil Whelan <phil123@gmail.com> wrote:
> Hi,
>
> I'm not sure why my IndexReader.reopen() call is not working.
>
> The latest results are not coming back, meaning the reader / searcher
> has not being re-opened for the new Documents that have been added.
>
>  IndexReader openReader = searcher.getIndexReader();
>  searcher.close();
>  openReader.reopen();
>  searcher = new IndexSearcher(openReader);
>
> If I close and open the reader, I do see the updated results, but I
> thought reopen was more efficient, so I really like to use that.
>
>  IndexReader openReader = searcher.getIndexReader();
>  searcher.close();
>  openReader.close();
>  openReader = IndexReader.open(new NIOFSDirectory(indexPath), true);
>  searcher = new IndexSearcher(openReader);
>
> Any advice? (using lucene 2.9rc4)
>
> Thanks,
> Phil
>



-- 
Mobile: +1  778-233-4935
Website: http://philw.co.uk
Skype: philwhelan76
Twitter: philwhln
Email : phil123@gmail.com
iChat: philwhln@mac.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message