Google AppEngine(GAE)上的Lucene

时间:2011-05-27 21:11:40

标签: google-app-engine lucene

我试图在GAE应用程序中使用lucene但是,使用lucene 3.1.0,即使使用RAMDirectory(应该没问题,我只有大约300个文档要索引),我提交或关闭索引时出错(见下文)。线索?

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:它当然适用于我的机器

1 个答案:

答案 0 :(得分:1)

我几个月前就已经开始在App Engine上工作了:

http://ikaisays.com/2010/04/24/lucene-in-memory-search-example-now-updated-for-lucene-3-0-1/

部署到App Engine时,您是否保留对RAMDirectory的全局引用?这将是有问题的,因为您没有单个JVM - 您可能有多个JVM。请求#1可能转到实例A,它初始化内存中索引,但请求#2可能转到实例B(不同的JVM),它仍然具有索引的空引用。这可能是发生了什么吗?