Haystack Whoosh 拼写建议太贪婪

发布于 2024-08-10 11:01:55 字数 380 浏览 4 评论 0原文

这个问题是关于 Django Haystack 的,带有 Whoosh 后端。 我想在搜索中使用拼写建议。问题是它暗示的太多了。

假设我有两个模型: 苹果和橙子。

如果我有这样的东西:

result = SearchQuerySet().models(Apples).filter(
    content=escaped_value).spelling_suggestion(escaped_value)

它实际上会查看 Oranges 模型并从中返回拼写建议!似乎模型(苹果)限制不起作用。

我为两个模型设置了索引,“文本”属性为 document=True。我的拼写已打开。我使用 Whoosh 作为后端。

This questions is about Django Haystack, with Whoosh backend.
I would like to use spelling suggestion in my search. The problem is that it is suggesting TOO much.

Say I have two models:
Apples and Oranges.

If I have somethine like this:

result = SearchQuerySet().models(Apples).filter(
    content=escaped_value).spelling_suggestion(escaped_value)

it will actually LOOK into Oranges model and return a spelling suggestion from that! It seems like models(Apples) restriction does not work.

I have indexes setup for both models, with "text" attribute as document=True. My spelling is ON. I am using Whoosh as backend.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北笙凉宸 2024-08-17 11:01:55

这是问题所在,因为 Haystack 根据具有 document=True 的字段创建拼写建议(在我的例子中,这是所有模型中的主要搜索字段,并且它们具有相同的名称)。因此它根本不关心模型,并且总是搜索所有知识库。

我向 haystack 提出了一个问题,并将其放在讨论板上。开发人员非常有帮助:
http://groups.google.com/group/django-haystack /browse_thread/thread/025e5ed42ccde8b9#

问题:
http://github.com/toastdriven/django-haystack/issues/#问题/124

This is the problem because Haystack creates spelling suggestions based on the fields which have document=True (which in my case are the primary search field in all models and they have the same name). So it does not care about models at all and alway searches across all the knowledgebase.

I filed an issue with haystack and brought it up on the discussion board. Dev is very helpful:
http://groups.google.com/group/django-haystack/browse_thread/thread/025e5ed42ccde8b9#

Issue:
http://github.com/toastdriven/django-haystack/issues/#issue/124

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文