Skip to content

Instantly share code, notes, and snippets.

@mdornseif
Created April 11, 2010 14:03
Show Gist options
  • Save mdornseif/362734 to your computer and use it in GitHub Desktop.
Save mdornseif/362734 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# encoding: utf-8
"""
search_sites.py - basic configuration for the haystack engine
"""
import haystack
import haystack.indexes
import django.contrib.flatpages.models
haystack.autodiscover()
class FlatpageIndex(haystack.indexes.SearchIndex):
text = haystack.indexes.CharField(document=True, model_attr='content')
#def get_queryset(self):
# """Used when the entire index for model is updated."""
# return Note.objects.filter(pub_date__lte=datetime.datetime.now())
# TODO: support
# registration_required
# sites
haystack.site.register(django.contrib.flatpages.models.FlatPage, FlatpageIndex)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment