简体   繁体   English

Django-haystack搜索静态内容

[英]Django-haystack search static content

My Django 1.10 app provides a search functionality using Haystack + Elastic Search. 我的Django 1.10应用程序使用Haystack + Elastic Search提供搜索功能。 It works great for models data, but I need to make it work for static content too (basically HTML files). 它适用于模型数据,但我需要使其适用于静态内容(基本上是HTML文件)。

I was thinking on scrapping the content from the HTML files (BeautifulSoup?) and save them to the database, this way the templates content could be indexed. 我正在考虑从HTML文件中删除内容(BeautifulSoup?)并将它们保存到数据库中,这样就可以将模板内容编入索引。

I found this module that does exactly what I need but seems deprecated: 我发现这个模块完全符合我的需要,但似乎已被弃用:

https://github.com/trapeze/haystack-static-pages https://github.com/trapeze/haystack-static-pages

So, what's the best way to allow haystack to find the content included in HTML pages? 那么,让haystack找到HTML页面中包含的内容的最佳方法是什么?

I forked the module haystack-static-pages and adapted it to my needs. 我将模块haystack-static-pages分叉并根据我的需要进行调整。 Now is compatible with Django 1.10 + haystack 2.5 and support login to scrap logged pages :) 现在兼容Django 1.10 + haystack 2.5并支持登录废弃登录页面:)

Updated version: https://github.com/pisapapiros/haystack-static-pages 更新版本: https//github.com/pisapapiros/haystack-static-pages

I know this is a pretty old topic but just in case anyone else lands here I have updated the above library for Django 1.11, Haystack 2.8.1 我知道这是一个非常古老的话题,但万一其他人在这里登陆我已经为Django 1.11更新了上面的库,Haystack 2.8.1

https://github.com/nkhumphreys/haystack-static-pages https://github.com/nkhumphreys/haystack-static-pages

(PR added but the above version hasn't had any love for a while) (PR增加了,但上面的版本暂时没有任何爱)

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

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