问题描述
我有一个大约 660MB 的 whoosh 2.7.4 索引。我可以完美地运行查询,但是一旦我尝试对单个查询结果执行任何操作(打印,将它们设置为一个变量),就会出现内存错误。我得到多少结果似乎并不重要。出现内存错误的结果多达 167 条,少则 10 条。
我还有一个大约 439MB 的 whoosh 2.7.4 索引。我可以运行查询并使用该索引对结果执行任何操作。
对于我的两个索引,在创建它们时,我在数据集中使用的文本文件都已打开并编码为 UTF-8。
我会在下面粘贴错误。
Traceback (most recent call last):
File "C:\Users\Itsspyke\Desktop\NLPIR\Python\NLPIR\Query.py",line 77,in <module>
doc_title = result["document_title"]
File "C:\Users\Itsspyke\Desktop\NLPIR\Python\NLPIR\venv\lib\site-packages\whoosh\searching.py",line 1505,in __getitem__
if fieldname in self.fields():
File "C:\Users\Itsspyke\Desktop\NLPIR\Python\NLPIR\venv\lib\site-packages\whoosh\searching.py",line 1393,in fields
self._fields = self.searcher.stored_fields(self.docnum)
File "C:\Users\Itsspyke\Desktop\NLPIR\Python\NLPIR\venv\lib\site-packages\whoosh\reading.py",line 686,in stored_fields
sfs = self._perdoc.stored_fields(docnum)
File "C:\Users\Itsspyke\Desktop\NLPIR\Python\NLPIR\venv\lib\site-packages\whoosh\codec\whoosh3.py",line 494,in stored_fields
reader = self._cached_reader("_stored",STORED_COLUMN)
File "C:\Users\Itsspyke\Desktop\NLPIR\Python\NLPIR\venv\lib\site-packages\whoosh\codec\whoosh3.py",line 412,in _cached_reader
reader = self.column_reader(fieldname,column)
File "C:\Users\Itsspyke\Desktop\NLPIR\Python\NLPIR\venv\lib\site-packages\whoosh\codec\whoosh3.py",line 399,in column_reader
self._colfiles[fieldname] = self._get_column_file(fieldname)
File "C:\Users\Itsspyke\Desktop\NLPIR\Python\NLPIR\venv\lib\site-packages\whoosh\codec\whoosh3.py",line 394,in _get_column_file
colfile = self._storage.open_file(filename)
File "C:\Users\Itsspyke\Desktop\NLPIR\Python\NLPIR\venv\lib\site-packages\whoosh\filedb\filestore.py",line 333,in open_file
return self.a.open_file(name,*args,**kwargs)
File "C:\Users\Itsspyke\Desktop\NLPIR\Python\NLPIR\venv\lib\site-packages\whoosh\filedb\compound.py",line 121,in open_file
f = BufferFile(buf,name=name)
File "C:\Users\Itsspyke\Desktop\NLPIR\Python\NLPIR\venv\lib\site-packages\whoosh\filedb\structfile.py",line 357,in __init__
self.file = BytesIO(buf)
MemoryError
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)