1 Star 0 Fork 0

asgter/DjangoBlog

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
search_indexes.py 630 Bytes
一键复制 编辑 原始数据 按行查看 历史
且听风吟 提交于 2019-04-21 03:34 +08:00 . 增加es埋点,优化es搜索
#!/usr/bin/env python
# encoding: utf-8
"""
@version: ??
@author: liangliangyy
@license: MIT Licence
@contact: liangliangyy@gmail.com
@site: https://www.lylinux.net/
@software: PyCharm
@file: search_indexes.py
@time: 2017/1/7 上午12:44
"""
from haystack import indexes
from django.conf import settings
from blog.models import Article, Category, Tag
class ArticleIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
def get_model(self):
return Article
def index_queryset(self, using=None):
return self.get_model().objects.filter(status='p')
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/asgter/DjangoBlog.git
git@gitee.com:asgter/DjangoBlog.git
asgter
DjangoBlog
DjangoBlog
master

搜索帮助