Thanks for feeback Uwe.
I'll not be looking at this until again tomorrow so at least this gives me
time to think it through.

On Wednesday, April 3, 2013, Uwe Schindler <[email protected]> wrote:
> Hi,
>
> In Lucene before 4.0 there was a close method in IndexSearcher, because
you were able to create IndexSearcher using Directory, which internally
opened an IndexReader. This IndexReader had to be closed, so there was a
need for IndexSearcher.close().
>
> In 3.x this was constructor (taking Directory/String/File) was deprecated
and you now have to pass an already open IndexReader to the constructor. In
4.x this deprecated stuff was finally removed and IndexSearcher is only a
thin wrapper around IndexReader, so you are responsible to open/close the
IndexReader, IndexSearcher no longer does this.
>
> Your try-finally block must be around IndexReader. But please note: Keep
IndexReader open as long as possible as it is very expensive to open/close
them all the time.
>
> Uwe
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: [email protected]
>
>
>> -----Original Message-----
>> From: Lewis John Mcgibbney [mailto:[email protected]]
>> Sent: Thursday, April 04, 2013 4:15 AM
>> To: [email protected]
>> Subject: Necessary to close() IndexSearcher in 4.X?
>>
>> Hi,
>> I am encountering many situations where searcher.close() is present in
finally
>> blocks such as
>>
>>         } finally {
>>             if (searcher != null) {
>>                 try {
>>                     searcher.close();
>>                 } catch (Exception ignore) {
>>                 }
>>                 searcher = null;
>>             }
>>         }
>>
>> Is some similar implementation still necessary in the 4.X API?
>>
>> Thank you very much
>>
>> Lewis
>>
>> --
>> *Lewis*
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

-- 
*Lewis*

Reply via email to