来自python lucene的Writer定义了错误

时间:2017-02-21 01:50:02

标签: python search indexing lucene writer

只需在我的python空闲中运行这几个命令,

>>> path = os.path.abspath("paths")

>>> directory = SimpleFSDirectory(Paths.get(path)) # the index

>>> analyzer = StandardAnalyzer()

>>> writerConfig = IndexWriterConfig(analyzer)

>>> writer = IndexWriter(directory, writerConfig)

我有这个错误,

Traceback (most recent call last):
  File "<pyshell#51>", line 1, in <module>
    writer = IndexWriter(directory, writerConfig)
JavaError: <super: <class 'JavaError'>, <JavaError object>>
    Java stacktrace:
org.apache.lucene.store.LockObtainFailedException: Lock held by this virtual machine: /Users/serenayuan/Documents/2017/paths/write.lock
    at org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:127)
    at org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:41)
    at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:45)
    at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:791)

我认为我遵循了python lucene的正确声明约定,并且无法理解为什么会出现此错误。

0 个答案:

没有答案