lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: Lucene index directory on disk: (i) do I need to keep it and (ii) how do I handle encryption?
Date Tue, 24 Apr 2012 15:44:17 GMT
FSDirectory won't load the index into RAM.

But RAMDirectory can: eg, you can init a RAMDirectory, passing your
FSDir to its ctor, to copy all files into RAM.  Then you can delete
the FSDir, but realize this means once your app shuts down you've lost
the index.

I think you can handle your encrypted case by copying the files
yourself from FSDir into RAMDir, decrypting as you go.

Mike McCandless

On Tue, Apr 24, 2012 at 10:36 AM, Ilya Zavorin <> wrote:
> I have two somewhat related questions. I'm working on an Android app that uses Lucene
indexing and search. Currently, I precompute an index on desktop and then copy the resulting
index folder and files to the Android device. In my app, I open the index up like this:
> String indexDir = "/mnt/sdcard/MyIndexDir";
> Directory dir =;
> I have 2 questions:
> 1. Does Lucene load the entire index into memory? If so, does it mean that after creating
the Directory object, I can delete the index dir from the device? Does this depend on the
size of the index? If so, do I have an option of forcing it to load the whole index into memory
regardless of its size?
> 2. Right now the index folder is unencrypted. This is temporary: we have a requirement
to encrypt every single file and folder that is used by the app. The problem with this is
that I can't create an unencrypted copy of the folder on the device, i.e. I can't do something
like this:
> String indexDirEncr = "/mnt/sdcard/MyIndexDirEncr";
> String indexDirUnencr = "/mnt/sdcard/MyIndexDirUnencr";
> //
> // Decrypt indexDirEncr and store it in indexDirUnencr
> //
> Directory dir =;
> Is there a good way to handle this? That is, is it somehow possible to load the encrypted
folder into memory, decrypt it and then load the decrypted version from memory to create a
Directory object?
> Thanks much!
> Ilya Zavorin

View raw message