我的 Lucene 代码中有一行:
try
{
searcher.GetIndexReader();
}
catch(Exception ex)
{
throw ex;
}
finally
{
if (searcher != null)
{
searcher.Close();
}
}
在我的 finally 子句中,当我执行 searcher.Close() 时,它是否也会在幕后执行 searcher.GetIndexReader().Close?
还是我需要显式调用 searcher.GetIndexReader().Close() 方法来关闭 IndexReader?
谢谢阅读。