Read the javadocs for MMapDirectory. -- Ian.
On Mon, Aug 16, 2010 at 2:21 PM, Mylnikov Sergey <semy...@yandex.ru> wrote: > Hi, > > I want to be able to regenerate index from time to time. I'm using > IndexSearcher for search and want to be able to release the current index > file so that I can replace it with the new one. But once IndexSearcher is > instantiated it does not seem to release index file even if I call close(). > > I'm running the test on Windows XP. Here is a short test that I use: > > String indexDir = "C:/IndexTemp2/index/"; > IndexSearcher searcher = new IndexSearcher(new MMapDirectory(new > File(indexDir))); > searcher.close(); > /* > Trying to see if the index file can be modified > */ > new FileWriter(indexDir + "_0.cfs"); > /* > java.io.FileNotFoundException: C:\IndexTemp2\index\_0.cfs > (The requested operation cannot be performed on a file with a user-mapped > section open.) > */ > > After I close IndexSearcher I try to check if I can modify file, but it is in > use. > > Could someone tell me what is the correct way to close the IndexReader? > > I will try to attach the JUnit test class and index directory as ZIP archive > to this message. > > Thanks, > Sergey > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org