lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Smith <>
Subject Cloning of RAMDirectory.
Date Thu, 22 May 2003 13:36:37 GMT

Hi Lucene Developers,
   Thanks for a great product!
I need to be able to 'snapshot' our in-memory indices (RAMDirectory

I have been using :

RAMDirectory activeDir = new RAMDirectory();
// many inserts, deletes etc
RAMDirectory cloneDir = new RAMDirectory(activeDir);

but unfortunately this is rather slow for large indices.

I have a suggestion - implement java.lang.Cloneable interface
in RAMDirectory.  I.e to be able to call :

RAMDirectory cloneDir = (RAMDirectory)activeDir.clone();

This bypasses the input/output stream handling of the
copy constructor by cloneing the underlying buffers that
form the directory and is much faster. (Diff attached).

Any comments?



View raw message