- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在使用带有 whoosh 的 haystack 作为 Django 应用程序的后端。
有什么方法可以查看whoosh生成的索引的内容(以易于阅读的格式)?我想看看索引了哪些数据以及如何索引,以便更好地理解它的工作原理。
最佳答案
您可以从 python 的交互式控制台很容易地做到这一点:
>>> from whoosh.index import open_dir
>>> ix = open_dir('whoosh_index')
>>> ix.schema
<<< <Schema: ['author', 'author_exact', 'content', 'django_ct', 'django_id', 'id', 'lexer', 'lexer_exact', 'published', 'published_exact']>
您可以直接在索引上执行搜索查询并执行各种有趣的操作。要获取每份文件,我可以这样做:
>>> from whoosh.query import Every
>>> results = ix.searcher().search(Every('content'))
如果您想将其全部打印出来(用于查看或其他目的),您可以使用 python 脚本轻松完成。
for result in results:
print "Rank: %s Id: %s Author: %s" % (result.rank, result['id'], result['author'])
print "Content:"
print result['content']
您还可以在 django View 中直接从 whoosh 返回文档(也许使用 django 的模板系统进行漂亮的格式化):请参阅 whoosh 文档以获取更多信息:http://packages.python.org/Whoosh/index.html .
关于python - Whoosh 索引查看器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2395675/
我有一个包含约 900 万行的 CSV 文件。我希望能够快速从该文件中搜索一行。我决定使用 python whoosh 来索引这些数据,然后搜索它,如下所示。 schema = Schema(cont
我正在使用 Whoosh 索引和搜索各种编码的各种文本。但是,在对我的索引文件执行搜索时,一些匹配结果没有出现在使用“突出显示”功能的输出中。我觉得这与编码错误有关,但我无法弄清楚是什么阻止了所有结果
此代码直接来自 Whoosh 的 quickstart docs : import os.path from whoosh.index import create_in from whoosh.fie
感谢您花时间提前回答这个问题。我对 Python (3.6) 和 Whoosh (2.7.4) 都比较陌生,所以如果我遗漏了一些明显的东西,请原谅我。 Whoosh 2.7.4 — 合并结果错误 我正
Whoosh 是一个用纯 Python ( official website) 实现的快速、功能强大的全文索引和搜索库。 但我找不到与其他搜索引擎相比的任何速度/性能比较,尤其是基于 Lucene 的
我正在使用带有 whoosh 的 haystack 作为 Django 应用程序的后端。 有什么方法可以查看whoosh生成的索引的内容(以易于阅读的格式)?我想看看索引了哪些数据以及如何索引,以便更
有没有人有使用django-haystack的经验与 whoosh后端? 我希望将它用于分类的实时搜索类型工具。在生产环境中是否足够快速/高效以避免设置 solr或 xapian ? 最佳答案 作为一
我正在使用 django haystack 1.27。我可以搜索。那太棒了。但我怎样才能搜索部分单词呢? 例如: 搜索:OREM、OR、EM 单词:LOREM 结果:LOREM 搜索索引.py cla
我正在尝试结合使用 Haystack 和 Whoosh 在我的应用程序中编制索引和搜索。当我重建索引时,我得到了这个结果: All documents removed. Updating backen
这个问题是关于 Django Haystack 的,带有 Whoosh 后端。我想在搜索中使用拼写建议。问题是它暗示的太多了。 假设我有两个模型:苹果和橙子。 如果我有这样的东西: result =
我正在尝试使用 Whoosh 索引一些文档。然而,当我尝试将文档添加到 Whoosh 索引时,Python 最终返回以下错误: RecursionError: maximum recursion de
我开始研究内容索引的实现,并且看了一下 Whoosh ( https://pypi.python.org/pypi/Whoosh/ )。 我很想知道 Whoosh 将其内容物理存储在哪里 - 它使用文
默认情况下,多词搜索被拆分成文件,每个词单独存在。我怎样才能覆盖这个默认值并快速搜索完全匹配的内容?尽管它很可能受支持,但我在 google/whoosh 文档中找不到。 此外,与相同的多词搜索相比,
我似乎一辈子都无法安装 whoosh alchemy。引用:http://pythonhosted.org/Flask-WhooshAlchemy/ .不管怎样,我在关注http://blog.mig
我已经用这样的模式为我的所有文档编制了索引: ID = ID(stored=True) Body = TEXT(analyzer=StemmingAnalyzer(), stored=False,fi
我正在尝试实现 Okapi BM25 以使用 python 通过查询搜索文档 whoosh图书馆。 我的理解是whoosh根据query使用BM25计算每篇文档的score,然后排序得到最好的结果。
这个奇怪的错误是在我中断了 whoosh 提交过程后出现的。当我现在尝试 promise 时,我得到了 File "/usr/local/lib/python2.7/dist-packages/w
我正在创建一个必须支持嵌套数据层次结构的搜索索引。出于测试目的,我正在制作一个非常简单的架构: test_schema = Schema( name_ngrams=NGRAMWORDS(min
我使用了来自 pythonhosted.org 的示例代码,但似乎没有发生任何事情。这是我使用的代码: results = mysearcher.search(myquery) for hit in
我有一个如下所示的索引架构: schema = Schema( title=TEXT(stored=True), content=TEXT, id=ID, topicI
我是一名优秀的程序员,十分优秀!