Google AppEngine(GAE)上的Lucene

raf*_*idi 5 lucene google-app-engine

我试图在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)
Run Code Online (Sandbox Code Playgroud)

PS:它当然适用于我的机器

小智 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),该实例仍具有索引的空引用。这可能就是正在发生的事情吗?