Django Haystack Faceting示例 [英] Django Haystack Faceting examples

查看:111
本文介绍了Django Haystack Faceting示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我正在工作的站点中使用Django-Haystack-Solr.我已经阅读了Haystack文档中的示例,并在Internet上广泛搜索了其他示例.我很难将其集成到我的网站中.我发现 http://www.slideshare.net/Nagyman/faceted-navigation-using-django-haystack-and-solr 很有趣,但是缺少如何将它们组合在一起的方法.如果有人遇到过一些健壮"的Haystack构面示例,开放源代码的网站或愿意共享您自己的一些代码的网站,请提供链接/共享代码.感谢您的帮助.

I want to use Django-Haystack-Solr in a site I am working on. I have worked through the examples in the Haystack documentation and have searched the internet extensively for other examples. I am having difficulty making the leap to integrating it in my site. I found http://www.slideshare.net/Nagyman/faceted-navigation-using-django-haystack-and-solr interesting, but fell short of how to pull it all together. If anyone has run across some "robust" Haystack faceting examples, websites that are open-source, or would be willing to share some of your own code please provide links/share code. Thanks for the help.

btw-我想在多个模型(表)的多个字段上进行构面,并想出一种对构面使用替代标签的方法.

btw - I want to facet on multiple field from multiple models(tables), and figure out a way to use alternate labels for the facets.

推荐答案

这是我针对该主题编写的最新教程.它使用弹性搜索而不是我个人认为更易于实现的solr.

Here's a recent tutorial I did on the topic. This uses Elastic search instead of solr which I personally believe is easier to implement.

Django Haystack + Elasticsearch + Autocomplete + Faceting教程

我实现了以下演示商店站点,以基于多项选择来演示构面.

I implemented the following demo store site to demonstrate faceting based on multiple selection.

尽管从图中看不出来,但本教程还讨论了自动完成的实现.

Though not apparent from the image, this tutorial also discusses auto-complete implementation.

但是,即使您想与Solr一起使用,大多数与构面和自动完成相关的代码也保持不变.所以是的,如果您使用Solr,此代码同样适用.对于solr,您只需要在设置文件中更改HAYSTACK_CONNECTIONS的值并通过运行manage.py build_solr_schema来构建Solr索引.将XML输出拖放到Solr的schema.xml文件中,然后重新启动Solr服务器. Python/Django代码没有其他改变.

But even if you want to use this with Solr, most of the code related to faceting and auto-complete remains the same. So yes, this code is equally applicable if you are using Solr.For solr you just need to change the value of HAYSTACK_CONNECTIONS in your settings file and build Solr index by running manage.py build_solr_schema. The drop the XML output in your Solr’s schema.xml file and restart your Solr server. Nothing else changes in the Python/Django code.

Whoosh实现了构面,但是Django Haystack在此开发上尚未赶上Whoosh,因此,如果要实现构面,请不要使用它.

Whoosh implements faceting but Django Haystack is yet to catch up with Whoosh on this development, so stay clear of it if you want to implement faceting.

该代码太大,无法在此处共享,但是对于任何想直接进入该代码的人,这是

The code is too large to be shared here but for anyone wanting to dive right into the code, here's the complete source code.

这篇关于Django Haystack Faceting示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆