I was trying to use lucene in a GAE application but, with lucene 3.1.0, even using RAMDirectory (which should be ok, I have only about 300 docs to index), I have an error committing or closing the index (see below). Clues?
Caused by: java.lang.NullPointerException
at org.apache.lucene.store.IndexOutput.writeString(IndexOutput.java:103)
at org.apache.lucene.store.IndexOutput.writeStringStringMap(IndexOutput.java:221)
at org.apache.lucene.index.SegmentInfo.write(SegmentInfo.java:619)
at org.apache.lucene.index.SegmentInfos.write(SegmentInfos.java:381)
at org.apache.lucene.index.SegmentInfos.prepareCommit(SegmentInfos.java:851)
at org.apache.lucene.index.IndexWriter.startCommit(IndexWriter.java:4224)
at org.apache.lucene.index.IndexWriter.prepareCommit(IndexWriter.java:3161)
at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:3232)
at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:3214)
at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:3198)
PS: it of course works on my machine
I've gotten this to work on App Engine a few months ago:
http://ikaisays.com/2010/04/24/lucene-in-memory-search-example-now-updated-for-lucene-3-0-1/
When deploying to App Engine, are you keeping a global reference to a RAMDirectory? This is going to be problematic because you do not have a single JVM - you might have multiple JVMs. Request #1 might go to Instance A, which initializes the in-memory index, but request #2 may go to Instance B (different JVM) that still has a null reference for the index. Could this be what is happening?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With