[pylucene-dev] in-memory index?

Andi Vajda vajda at osafoundation.org
Fri Jun 27 13:30:27 PDT 2008

On Fri, 27 Jun 2008, Darren Govoni wrote:

>  I saw the RAMDirectory examples, but they didn't quite do what I need.
> The examples I saw showed how to create an in-memory index, write docs
> to it, then search it. What I need is to read a disk-based index into
> memory, then search it (entirely in memory, not cached). I will hop over
> to the Lucene folks. Just wasn't sure if PyLucene supported that
> specific behavior or not.

PyLucene supports whatever Java Lucene does. PyLucene is a wrapper around 
Java Lucene. The Java Lucene jars are part of the PyLucene egg and a Java VM 
is embedded in your Python process.

Quite simply, to load an index into memory completely:
   - open up the file index -> fileindexreader
   - create a new index with a RAMDirectory  -> ramindexwriter
   - call ramindexwriter.addIndexes([fileindexreader])

But, like I said, general Lucene questions are best answered on the actual 
Lucene list. And the above steps may be bogus.


More information about the pylucene-dev mailing list