MrDoc/app_doc/search_indexes.py
2020-11-26 20:55:44 +08:00

20 lines
584 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# coding:utf-8
# @文件: search_indexes.py
# @创建者:州的先生
# #日期2020/11/22
# 博客地址zmister.com
from haystack import indexes
from app_doc.models import *
# 文档索引
class DocIndex(indexes.SearchIndex,indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
top_doc = indexes.IntegerField(model_attr='top_doc')
modify_time = indexes.DateTimeField(model_attr='modify_time')
def get_model(self):
return Doc
def index_queryset(self, using=None):
return self.get_model().objects.filter(status=1)