You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Peter Gelderbloem <Pe...@mediasurface.com> on 2005/09/06 14:25:37 UTC

Switching from FSDirectory to RAMDirectory

Hi,
I find that unit tests that modify an existing record in the Lucene
index by removing it , modifying it and re-adding it, fails if I switch
from an FSDirectory to a RAMDirectory.
This code gives me a Directory that works:

FSDirectory fsDirectory =
FSDirectory.getDirectory(physicalDirectoryName, 
	
!IndexReader.indexExists(physicalDirectoryName));
returnValue = /*new RAMDirectory(*/fsDirectory/*)*/;

This code gives me a non-working Directory:

FSDirectory fsDirectory =
FSDirectory.getDirectory(physicalDirectoryName, 
	
!IndexReader.indexExists(physicalDirectoryName));
returnValue = new RAMDirectory(fsDirectory);

Please help!
The only solution I can think of involves pulling out my hair...
:(


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Switching from FSDirectory to RAMDirectory

Posted by Chris Hostetter <ho...@fucit.org>.
: Hi,
: I find that unit tests that modify an existing record in the Lucene
: index by removing it , modifying it and re-adding it, fails if I switch
: from an FSDirectory to a RAMDirectory.

Could you please post a full and complete unit test that demonstrates the
problem.  Based on your description of the problem, it seems like a test
of about 20 lines should demonstrate the problem.


Off the top of my head, i'm guessing that at some point in your tests, you
close your reader and reopen it (possibly while constructing an
IndexSearcher) to see your modifications, and at that point maybe you are
accessing the orriginal FSDirectory.




-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org