简体   繁体   English

django干草堆或狮身人面像的简单搜索?

[英]django haystack or sphinx for simple search?

I am creating a food search. 我正在寻找食物。 I want to simply be able to type a food into a search box and have it return results. 我只想能够在搜索框中输入食物并返回结果即可。 I also want to be able to add priority to certain terms so that they show up. 我还希望能够为某些术语添加优先级,以便它们出现。 For example, searching for "orange" would bring up the fruit first as opposed to the juice. 例如,搜索“橙色”将首先带来水果,而不是果汁。

I haven't been able to determine the better search solution for this scenario in django. 在django中,我无法为这种情况确定更好的搜索解决方案。

Let me know which is the better solution for this scenario. 让我知道对于这种情况哪个是更好的解决方案。

I'm the current maintainer of Django-SphinxQL , an implementation for Sphinx in Django, and maintainer of the Xapian backend for Haystack. 我是Django-SphinxQL的当前维护者, Django中Sphinx的实现,以及Haystack的Xapian后端的维护者。

I recommend using Haystack: 我建议使用Haystack:

  • Haystack allows you to choose between different backends, support most standard features of search (eg highlight), and already stood the test of time on search engines for Django. Haystack允许您在不同的后端之间进行选择,支持搜索的大多数标准功能(例如,高亮显示),并且已经在Django搜索引擎上经受了时间的考验。

  • Django-SphinxQL is in pre-alpha (other implementations such has Django-Sphinx have stalled), and only support a minimal set of functionality. Django-SphinxQL处于pre-alpha模式(其他实现(例如Django-Sphinx的实现已停滞)),并且仅支持少量功能。

The only reason I see to choose Sphinx search in detriment of Haystack (eg using Django-SphinxQL) is if you specifically have a use case where Sphinx is clearly superior to any Haystack backend. 我看到选择不利于Haystack的Sphinx搜索(例如,使用Django-SphinxQL)的唯一原因是,如果您特别有一个用例,其中Sphinx明显优于任何Haystack后端。

For instance, Sphinx is known to be very fast indexing in the plain index, but it requires you to re-index everything when you update the database. 例如,众所周知,Sphinx在plain索引中的索引非常快,但是在更新数据库时,它要求您重新索引所有内容。 This particular setup is very convenient for me because I'm using it to index a database that only changes once a day. 对于我来说,这种特殊的设置非常方便,因为我正在使用它为每天仅更改一次的数据库建立索引。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM