tropo://techno/java /lucene

This is a utility that makes it easy for existing Lucene code to use a RAM or memory index instead of a disk-based one. This utility converts a Directory to a RAMDirectory. The use case would be:

Before


String indexName = ...;
searcher = new IndexSearcher( indexName);
    

After

	   
import com.tropo.lucene.*;	   
String indexName = ...;
searcher = new IndexSearcher( Rammer.convert( indexName)); 

Download

Rammer.java

Performance

In some testing of a 2000 document, 4MB index the time to convert the index to a RAMDirectory was essentially the same as not converting it (both variations approx 70 ms). In some experimental code that looks at the frequencies of all pairs of terms and thus uses an O(N^2) algorithm, run times were:
  1. App 1: From 45 to 35 secs using Rammer.convert()
  2. App 2: From 22 to 18 secs using Rammer.convert()
Thus it reduces time approx 20%.