Re: Anyone have implemented a Database Directory ?
Tuesday, August 6, 2002 02:29 PM
A friend and I have implemented a MySQL DBDirectory for Lucene. It works, but we are sure that it is not the most efficient way to do it.
This is how we did it.
The DbDirectory class is basically the RAMDirectory class from the lucene jar, but with a few changes (RAMFile is now DbFile, etc...) At first, to see if it would work, I just serialized the DbDirectoy class and store that, but it gets too big too fast. Then we saw that you only have to store the files that are in the Hashtable (String fileNames, DbFile) where a DbFile is much like the RAMFile only altered :) This way you can also randomly access the segments when needed (although we haven't done that yet). Anyway if you would like some code send me an email. I hope this helps...