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 4、およびhaystack 2.0を実行しています。私のグーグルでは、人々が xapian と whoosh で同様の問題を経験しているのを見てきましたが、これまでのところ解決策は提供されていません。haystack の新しいバージョンか、私の sqlite3 データベースのように感じます。誰でもこれを理解していますか?

4

2 に答える 2

3

search_index.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 に答える