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

Reply via email to