python whoosh索引中断时出错
这个奇怪的错误出现在我中断了whoosh提交过程之后。当我现在试图承诺的时候,我得到了python whoosh索引中断时出错,python,whoosh,Python,Whoosh,这个奇怪的错误出现在我中断了whoosh提交过程之后。当我现在试图承诺的时候,我得到了 File "/usr/local/lib/python2.7/dist-packages/whoosh/filedb/filewriting.py", line 179, in _check_state raise IndexingError("This writer is closed") whoosh.writing.IndexingError: This writer is clos
File "/usr/local/lib/python2.7/dist-packages/whoosh/filedb/filewriting.py", line 179, in _check_state
raise IndexingError("This writer is closed")
whoosh.writing.IndexingError: This writer is closed
我已经尝试重新安装lib,更改索引目录,但它不起作用。那么我怎样才能修复嗖嗖声呢?我认为没有必要“修复嗖嗖声”(或索引) 可能只是您的代码打开一个编写器,使用它,关闭它,然后再次尝试使用关闭的编写器 只要一直这样做:
with myindex.writer() as w:
w.add_document(title=u"First document", content=u"Hello there.")
w.add_document(title=u"Second document", content=u"This is easy!")
如果以后需要添加更多文档(在此“with”-块之外),请以相同的方式打开新的编写器
注意:writer w在离开with块时自动关闭,这就是所谓的上下文管理器的工作方式。我认为没有必要“修复嗖嗖”(或索引) 可能只是您的代码打开一个编写器,使用它,关闭它,然后再次尝试使用关闭的编写器 只要一直这样做:
with myindex.writer() as w:
w.add_document(title=u"First document", content=u"Hello there.")
w.add_document(title=u"Second document", content=u"This is easy!")
如果以后需要添加更多文档(在此“with”-块之外),请以相同的方式打开新的编写器
注意:writer w在离开with块时自动关闭,这就是所谓的上下文管理器的工作方式