var provider = ...
using (var session = ..)
{
session.Add(..);
session.Commit();
session.Add(...)
}
provider.Dispose();
and having application opened
I can't remove or move my created index files from disk because they are used by a process.
Examining the code i found that the context.Reload() call recreates IndexSearcher with a new IndexReader instance, but the old reader remains still opened inside the tracker's IndexSearcher. And tracker.Dispose() just disposes the IndexSearcher that was created with an internal closeReader: false flag so it remains opened.
From lucene sources it's clear
/// Note that the underlying IndexReader is not closed, if
/// IndexSearcher was constructed with IndexSearcher(IndexReader r).
/// If the IndexReader was supplied implicitly by specifying a directory, then
/// the IndexReader gets closed.
///
///
public IndexSearcher(IndexReader r):this(r, false)
{
}
Maybe this was a strategy. I am asking because this issue doesn't give me a chanse to optimize the index because it's remains opened.
Hi.
When i execute this code
and having application opened
I can't remove or move my created index files from disk because they are used by a process.
Examining the code i found that the context.Reload() call recreates IndexSearcher with a new IndexReader instance, but the old reader remains still opened inside the tracker's IndexSearcher. And tracker.Dispose() just disposes the IndexSearcher that was created with an internal closeReader: false flag so it remains opened.
From lucene sources it's clear
/// Note that the underlying IndexReader is not closed, if /// IndexSearcher was constructed with IndexSearcher(IndexReader r). /// If the IndexReader was supplied implicitly by specifying a directory, then /// the IndexReader gets closed. /// ///
public IndexSearcher(IndexReader r):this(r, false) { }
Maybe this was a strategy. I am asking because this issue doesn't give me a chanse to optimize the index because it's remains opened.
Thanks