一次搜索多个索引

2024-05-08 23:41:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我有几个索引作为存储对象的一部分位于同一目录中

from whoosh.filedb.filestore import FileStorage
storage = FileStorage("../indexdir")
ix_1 = storage.open_index(indexname='ind_1')
ix_2 = storage.open_index(indexname='ind_2')

我希望能够同时在两个索引中搜索查询,而不仅仅是其中一个索引。不需要一个索引就可以这样做吗? 我可以一个接一个地附加每个索引的结果,但我不知道如何对它们进行排序,或者这是否可行


Tags: 对象fromimport目录indexstorageopenix