Where does Whoosh (Python) physically store the indexed content?

一笑奈何 提交于 2020-01-04 09:19:09

问题


I am beginning to research on content indexing implementation, and was having a look at Whoosh (https://pypi.python.org/pypi/Whoosh/).

I am curious to know where Whoosh stores its content physically - Is it using files?


回答1:


Whoosh uses a pluggable storage system; if you use the create_in() function then a FileStorage() class is used that stores indexes in files in a directory.

See the Whoosh quickstart:

Once you have the schema, you can create an index using the create_in function:

import os.path
from whoosh.index import create_in

if not os.path.exists("index"):
    os.mkdir("index")
ix = create_in("index", schema)

(At a low level, this creates a Storage object to contain the index. A Storage object represents that medium in which the index will be stored. Usually this will be FileStorage, which stores the index as a set of files in a directory.)



来源:https://stackoverflow.com/questions/26955410/where-does-whoosh-python-physically-store-the-indexed-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!