【问题标题】:Whoosh Concurrency Search嗖嗖并发搜索
【发布时间】:2019-09-26 12:57:14
【问题描述】:

我有一个包含 500 万个使用 Whoosh 索引的小文档的索引(大小 = 3.5 GB)。

由于我的文档只有namecontent,所以我的Schema很简单,只有两个字段:idcontent

schema = Schema(name = ID(stored=True),
                content = TEXT(stored=True),
                )

为了测试性能,我使用了一组 70,000 个查询,但 Whoosh 执行每个查询大约需要 20 秒。

index = open_dir("../data/search/bm25_index/")
query_parser = QueryParser("content", schema=index.schema)
q = query_parser.parse("some query")
with index.searcher(weighting=scoring.TF_IDF()) as searcher:
    results = searcher.search(q)

既然索引是无状态的,我怎么能执行多线程搜索呢?

【问题讨论】:

    标签: python-3.x multithreading concurrency whoosh


    【解决方案1】:

    可以使用python的多线程。看poolprocess

    【讨论】:

      猜你喜欢
      • 2019-03-30
      • 2012-08-06
      • 1970-01-01
      • 1970-01-01
      • 2016-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多