When you need a full-text search for Django-CMS-based website, you can use Haystack and django-cms-search. The latter module ensures that all CMS Pages get indexed.
One important thing to mention is that if you use any custom Plugins, search_fields
need to be defined for them, so that the Pages using them are indexed properly. For example, here is an Overview plugin which makes its title and description searchable:
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin
class Overview(CMSPlugin):
title = models.CharField(_('Title'), max_length=200)
description = models.TextField(_('Description'))
url = models.URLField(_('url'), max_length=200, blank=True)
search_fields = ("title", "description")
def __unicode__(self):
return self.title
For more information check the documentation online:
No comments:
Post a Comment