4

I have a Django app that has an accompanying user guide. Page content for the user guide is stored in a directory of templates. Haystack seems to be the most popular Django search engine, but it is only recommended for use on model data and doesn't seem to provide template indexing.

What's the best method of indexing the Django template content for search? I could create a model which stores the rendered templates, and index that using Haystack. Is there any software out there that does this already? Or any alternative ways of doing this? Any solution needs should preferably include rendered content (i.e. can't just index the templates straight from disk). I also wish to avoid any external ad-supported search engines like Google Custom Search and Django integration is desirable.

Any suggestions would be much appreciated, thanks.

4

1 回答 1

2

haystack_static_pages就是为此目的而制作的。

该应用程序旨在抓取和索引您自己网站上的指定呈现页面。您配置 URL 或 URL 名称,然后使用管理命令来抓取您的站点。

值得注意的是关于这方面的一些事情。Haystack 与 Django ORM 的耦合非常紧密,所以要做haystack_static_pages的是为静态内容添加一个模型,然后将爬取的内容转储到模型中,作为索引的前兆。它似乎也是围绕 Haystack 的 1.x 版本设计的。

于 2013-02-11T21:24:00.943 回答