1

我有一个部分看起来像这样的模型:

class Content(models.Model):
    published = models.BooleanField(default=False)
    public = models.BooleanField(default=False)

我的搜索索引继承自 CelerySearchIndex:

class ContentIndex(celery_haystack_indexes.CelerySearchIndex, indexes.Indexable): 

SearchIndex被调用时Content.save(),我希望将此内容编入索引。我预计我网站上未发布的内容会经过大量修改,因此浪费对 Solr 的调用会对性能造成巨大影响。但是,文档中的任何内容似乎都不起作用。

我试过了:

def should_update(self, content):
    if content.published and content.public:
        return True
    return False

我也尝试连接到update_object().

在这两种情况下,任何一个例程都没有被调用。

有人知道怎么做吗???非常感谢!

4

1 回答 1

0

根据文档,您的方法签名中似乎缺少传递给 should_update 的 **kwargs 。也许尝试添加?

于 2013-01-16T14:30:19.373 回答