尝试运行时出现以下错误./manage.py build_solr_schema
NotImplementedError: Subclasses must provide a way to build their schema.
这是我的两个搜索索引的样子:
class BookSearchIndex (SearchIndex):
text = CharField(document=True, use_template=True)
title = CharField(model_attr='title_web', boost=1.125)
def index_queryset(self):
return Book.objects.active().filter(publish_level='published')
site.register(Book, BookSearchIndex)
class AuthorSearchIndex (SearchIndex):
text = CharField(document=True, use_template=True)
name = CharField(model_attr='name_display', boost=1.5)
def index_queryset(self):
return Author.objects.approved()
def prepare(self, obj):
data = super(AuthorSearchIndex, self).prepare(obj)
data['boost'] = 1.5
return data
site.register(Author, AuthorSearchIndex)
我在本地运行它并使用简单的后端。build_solr_schema
创建作者索引后,我能够运行。但是当我设置书籍索引并尝试再次运行它时,我得到了提到的错误。
Django 1.4.2,干草堆 1.2.7
有任何想法吗?