最好的Django搜索应用是什么?[关闭]

问题:最好的Django搜索应用是什么?[关闭]

我正在建立一个需要搜索功能的Django项目,直到有一个 django.contrib.search,我必须选择一个搜索应用程序。那么,哪个最好?“最好”是指…

  • 易于安装/设置
  • 具有Django或至少Python友好的API
  • 可以执行相当复杂的搜索

这是我听说过的一些应用程序,如果您知道其中任何一个,请建议其他应用程序:

我还想避免使用第三方搜索引擎(例如Google SiteSearch),因为我想索引的某些数据仅适用于网站成员,不应公开。

I’m building a Django project that needs search functionality, and until there’s a django.contrib.search, I have to choose a search app. So, which is the best? By “best” I mean…

  • easy to install / set up
  • has a Django- or at least Python-friendly API
  • can perform reasonably complex searches

Here are some apps I’ve heard of, please suggest others if you know of any:

I’d also like to avoid using a third-party search engine (like Google SiteSearch), because some of the data I’d like to index is for site members only and should not be public.


回答 0

查阅Haystack Search-一个基于模型的新模型,该抽象层目前支持XapianSolrWhoosh。看起来它得到了很好的支持和记录。

Check out Haystack Search – a new model based search abstraction layer that currently supports Xapian, Solr and Whoosh. Looks like it’s well supported and documented.


回答 1

贾斯汀,我先尝试djangosearch:Jacob Kaplan-Moss(Django的首席开发人员)正在研究它。

潜在危险:

  • 主页警告该API可能并不完全稳定

潜在的好处:

  • “长远的目标是要实现这一目标django.contrib.search。”

Justin, I’d try djangosearch first: Jacob Kaplan-Moss (Django’s lead developer) is working on it.

Potential hazards:

  • The home page warns the API might not be entirely stable

Potential benefits:

  • “The long term goal is for this to become django.contrib.search.”

回答 2

我正在寻找同一件事,就像其他许多人一样。希望很快会添加django.contrib.search

同时,这是我发现的内容:

对我来说,大多数看起来很复杂,坦率地说,实施起来有些艰巨。我很想了解您对这些的看法。

I am searching for the same thing, as are a lot of other people. Let’s hope that django.contrib.search will be added soon.

In the meantime, this is what I found:

To me, most look quite complicated and, frankly, a little daunting to implement. I’d be interested to learn what you think of these.


回答 3

djangosearch的google代码页表明它不再处于积极开发中,并建议haystacksolango

The google code page for djangosearch indicates that it is no longer under active development, and suggests haystack or solango.


回答 4

我建议使用Sphinx进行全文搜索和聚合,而django-sphinx足以用于生产环境。我们发现Sphinx是索引和搜索文档的资源最少,最快的方式,而django-sphinx是sphinx客户端之上的一个很好的包装器。

如果您想显示有多少个带有特定标签或由某个作者(或两者兼有)匹配的文档,则按聚合分组特别好。在内存中,属性更新也很方便,特别是对于立即删除已删除的文章。

I’d recommend Sphinx for full-text search and aggregation, and django-sphinx is good enough for production use. We found that Sphinx was the least resource-intensive and fastest way to index and search our documents and that django-sphinx was a nice wrapper on top of the sphinx client.

The group by aggregation is particularly nice, if for example you want to display how many documents with a certain tag or by a certain author (or both) matched a search. In memory attribute updates were convenient too, especially for removing deleted articles immediately.


回答 5

谢谢加思。我曾经见过djangosearch想成为正式的Django搜索,但是由于无法找到任何文档,我还是犹豫使用它!幸运的是,在Subversion中有一个自述文件,我以前从未见过,它使API看起来很酷:

# set up the model
class Event(models.Model):
    title = models.CharField(max_length=255)
    date = models.DateField()
    is_outdoors = models.BooleanField()

    index = djangosearch.ModelIndex(text=['title'], 
                                    additional=['date', 'is_outdoors'])

# run a search
results = Event.index.search("django conference")

Thanks Garth. I had seen that djangosearch wanted to become the official Django search, but I was hesitant to use it because I couldn’t find any documentation! Luckily, there’s a README in subversion that I hadn’t seen before, and it makes the API look very cool:

# set up the model
class Event(models.Model):
    title = models.CharField(max_length=255)
    date = models.DateField()
    is_outdoors = models.BooleanField()

    index = djangosearch.ModelIndex(text=['title'], 
                                    additional=['date', 'is_outdoors'])

# run a search
results = Event.index.search("django conference")

回答 6

我只需要一个非常快速的解决方案,对于内部应用程序来说就算是小菜一碟。

我很快找到了文章“ 将搜索添加到Django”,这对我来说非常出色!

显然,它缺乏像Haystack这样的真实项目的速度,可伸缩性和功能,但是此项目更易于设置,除关键字AND-search外,我真的不需要其他任何东西。

I just needed a very quick solution that was no-fuss for an internal app.

I found the article Adding search to Django in a snap, and that worked splendid for me!

Obviously it lacks the speed, scalability and features of the real projects like Haystack, but this one is easier to set up, and I don’t really need anything else than keyword AND-search.


回答 7

您可能需要考虑让Yahoo借助其构建自己的搜索服务(BOSS)来完成所有艰苦的工作。这是一篇很棒的博客文章,它将引导您完成整个过程:http : //www.peterkrantz.com/2008/yahoo-search-in-django/

You might want to consider letting Yahoo do all the hard work with their Build your own Search Service (BOSS). Here is a great blog post that walks you through the process: http://www.peterkrantz.com/2008/yahoo-search-in-django/


回答 8

好像这里的每个人都错过了django-xappy

在对Django的所有现有搜索插件进行了快速评估之后,我发现这是最灵活,最易于使用的插件。在几个地方的边缘都很粗糙,但这仍然是在Django项目中使用Xapian搜索引擎功能的最佳方法。

It looks like everyone here missed django-xappy

After quick evaluation of all existing search addons for Django, I found this one as most flexible and easiest to use. It’s rough on the edges in few places, but it’s still the best way to use power of Xapian search engine inside Django projects.


回答 9

您可能想看一下Django Solr搜索(又名“ Solango”),它附带了一些不错的文档来帮助您入门…

You might want to look at Django Solr search (aka “Solango”) which comes with some nice documentation to get you started…


回答 10

如果您要对大量数据建立索引或期望获得高流量,建议您使用一些外部搜索引擎,例如Solr。这样,您将保持无共享方式,并能够独立扩展站点组件。

If you have large amount of data to be indexed or you expect high traffic, I’d suggest using some external search engine, like Solr. This way, you’ll keep shared-nothing approach and be able to scale your site components independently.


回答 11

我想我将不得不向贾比安大喊大叫。

坚如磐石…只需拉下源代码分布并查看内部即可。一流的代码,评论不多。

它仍然是一个年轻的软件项目,但是我认为django社区应该将它的精力放在这个项目上。

I think I am going to have to give a shout out to Djapian.

It is rock-solid…just pull down a source distribution and peek inside. Top notch code, not very many comments tho..

It’s still a young software project, but I think the django community should throw it’s weight behind this one.


回答 12

谢谢乔,

我们决定使用Tsearch2和自定义的postgres适配器。Tsearch2不需要额外的进程来运行,这很方便,因为我们是在内存有限的WebFaction主机上进行的……它尚未完全完成,但似乎是一个很好的解决方案……

Thanks Joe,

We decided to go with Tsearch2 and a custom postgres adaptor. Tsearch2 does not need an extra process to run, which was convenient since we are on a WebFaction hosting with limited memory… It’s not completely done yet, but seems to be a good solution…


回答 13

我发现Djoosh依靠纯Python外部搜索引擎Whoosh与我的“ Python”大脑很好地配合。

I found Djoosh which relies on the pure-python external search engine Whoosh to work well with my ‘Python’ brain.


回答 14

如果您愿意使用第三方搜索引擎,我可以推荐Yahoo BOSSdjango-bosssearch

Yahoo BOSS是一项付费服务​​,但是它可以节省您在服务器上设置和维护其他搜索软件的费用。

If you are willing to use a 3rd party search engine I can recommend Yahoo BOSS and django-bosssearch.

Yahoo BOSS is a paid service, but it saves you setting up and maintaining other search software on your server.