lucene at mikemccandless
Apr 24, 2012, 8:44 AM
FSDirectory won't load the index into RAM.
Re: Lucene index directory on disk: (i) do I need to keep it and (ii) how do I handle encryption?
[In reply to]
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
I think you can handle your encrypted case by copying the files
yourself from FSDir into RAMDir, decrypting as you go.
On Tue, Apr 24, 2012 at 10:36 AM, Ilya Zavorin <izavorin [at] caci> 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 = FSDirectory.open(indexDir);
> 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 = FSDirectory.open(indexDirUnencr);
> 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