Is there a way of keeping the index in RAM instead of keeping it on the hard disk?
We want to make searching faster.
Check out the RAMDirectory documentation. Here's a basic usage example. This will only work if the index is small enough.