Reputation: 57
How can I get my models included in the index for rebuild_index
?
Running python manage.py rebuild_index -v2 outputs this:
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.
Of the above, myapp.models.Article
should be included. I have this in 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()
I'm running django 1.5, solr 4 and haystack 2.0 on an sqlite3 database. In my googling I've seen people experiencing a similar problem with xapian & whoosh, with no solutions provided thus far. I feel like it could be haystack's new version, or my sqlite3 database. Anyone understand this?
Upvotes: 3
Views: 1399
Reputation: 57
This is a useful link that I found too late: http://django-haystack.readthedocs.org/en/latest/debugging.html
Upvotes: 0
Reputation: 2270
search_index.py ? Is it a typo because it should be search_indexes.py . Isn't it . If you using correct name then please elaborate a little .
Upvotes: 3