从管理面板更新对象时,haystack index\u queryset筛选器不工作

qlzsbp2j  于 2021-06-14  发布在  ElasticSearch
关注(0)|答案(0)|浏览(169)

我正在为一个模型建立索引,其中有一些条件。很好用。但是,当我从管理面板更新一些信息的条件不工作。
搜索索引:

class QuestionBankIndex(indexes.SearchIndex, indexes.Indexable):
    text = indexes.CharField(document=True, use_template=True, template_name='search/question_bank_text.txt')
    question_id = indexes.IntegerField(model_attr='id')
    owner = indexes.CharField(model_attr='owner', null=True)

    def get_model(self):
        return QuestionBank

    def index_queryset(self, using=None):
        return self.get_model().objects.filter(active=True)

所以,当我从管理面板更改一个对象时,这个对象正在索引,即使它是active=false
我正在使用haystack==3.0和实时信号处理器配置。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题