Python 3.x 嗖嗖声:从索引中检索文档编号和标题
给定一个包含大量索引文档的语料库,我正在尝试检索带有相关文档编号的标题(索引字段) 如何从索引中逐项检索文档编号和标题 背景:我从一个数据库中检索了我的语料库,如下所示:Python 3.x 嗖嗖声:从索引中检索文档编号和标题,python-3.x,whoosh,Python 3.x,Whoosh,给定一个包含大量索引文档的语料库,我正在尝试检索带有相关文档编号的标题(索引字段) 如何从索引中逐项检索文档编号和标题 背景:我从一个数据库中检索了我的语料库,如下所示: schema = Schema(content=TEXT(stored=True), abstract=TEXT(stored=True), title=TEXT(stored=True)) # create whoosh scheme if not os.path
schema = Schema(content=TEXT(stored=True),
abstract=TEXT(stored=True),
title=TEXT(stored=True)) # create whoosh scheme
if not os.path.exists("indexdir"):
os.mkdir("indexdir") # create index loc
ix = index.create_in("indexdir", schema) # create index
ix = index.open_dir("indexdir")
writer = ix.writer() # writerfunction
for index, row in df.iterrows(): #index preprocessed columns from df
writer.add_document(title=row["new_title"], content=row["new_content"], abstract=row["new_abstract"]) # index documents
writer.commit() # end indexing and close