solr - django-haystack 和 solr : rebuild_index not adding models to index

标签 solr django-haystack

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

运行python manage.pyrebuild_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 数据库。有人明白这个吗?

最佳答案

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

关于solr - django-haystack 和 solr : rebuild_index not adding models to index,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17274609/

相关文章:

eclipse - 从eclipse中启动部署在tomcat中的solr服务器

python - 在 Django 中使用 HayStack + Solr 进行高级搜索?

lucene - SOLR:NGramFilterFactory 的问题

java - 在 Solr 中运行 Lire 图像搜索——如何?

java - Solr:当用多个词查询字段时,默认的 OR 运算符返回不相关的结果

solr - 使用查询更新 solr 文档?

python - 有没有办法将SearchQuerySet 转换为objects.filter 返回的类型? - Django

django - Django的干草堆elasticsearch自动完成不起作用

django - 如何使用 django-haystack 和 elasticsearch 后端进行模糊搜索?

python - Elasticsearch 异常ConnectionError