django-haystack& solr:rebuild_index不将模型添加到索引

时间:2013-06-24 11:41:04

标签: solr django-haystack

如何将我的模型包含在rebuild_index的索引中?

运行 python manage.py rebuild_index -v2 输出:

WARNING: This will irreparably remove EVERYTHING from your search index in connection 'default'.
Your choices after this are to restore from backups or rebuild via the `rebuild_index` command.
Are you sure you wish to continue? [y/N] y

Removing all documents from your index because you said so.
All documents removed.
Skipping '<class 'django.contrib.auth.models.Permission'>' - no index.
Skipping '<class 'django.contrib.auth.models.Group'>' - no index.
Skipping '<class 'django.contrib.auth.models.User'>' - no index.
Skipping '<class 'django.contrib.contenttypes.models.ContentType'>' - no index.
Skipping '<class 'django.contrib.sessions.models.Session'>' - no index.
Skipping '<class 'django.contrib.sites.models.Site'>' - no index.
Skipping '<class 'django.contrib.admin.models.LogEntry'>' - no index.
Skipping '<class 'myapp.models.Article'>' - no index.
Skipping '<class 'myapp.models.Source'>' - no index.
Skipping '<class 'taggit.models.Tag'>' - no index.
Skipping '<class 'taggit.models.TaggedItem'>' - no index.

在上述内容中,应包括myapp.models.Article。我在 myproject / myapp / search_index.py

中有此功能
from haystack import indexes
from myapp.models import Article    

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.all()

我在 sqlite3 数据库上运行 django 1.5 solr 4 haystack 2.0 。在我的谷歌搜索中,我看到人们遇到类似的问题与xapian&amp;哎呀,到目前为止还没有提供解决方案。我觉得它可能是haystack的新版本,或者是我的sqlite3数据库。有人理解这个吗?

2 个答案:

答案 0 :(得分:3)

search_index.py?这是一个错字,因为它应该是search_indexes.py。不是吗如果您使用正确的名称,请详细说明。

答案 1 :(得分:0)

这是一个我发现太晚的有用链接:http://django-haystack.readthedocs.org/en/latest/debugging.html

相关问题