3

如何让我的模型包含在索引中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.5solr 4haystack 2.0 。在我的谷歌搜索中,我看到人们在使用 xapian & whoosh 时遇到了类似的问题,但到目前为止还没有提供解决方案。我觉得可能是 haystack 的新版本,或者我的 sqlite3 数据库。有人明白这个吗?

4

2 回答 2

3

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

于 2013-06-24T16:49:59.923 回答
0

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

于 2013-06-25T08:02:18.127 回答