Skip to content

Instantly share code, notes, and snippets.

@bogsio
Created October 28, 2013 19:53
Show Gist options
  • Select an option

  • Save bogsio/7203447 to your computer and use it in GitHub Desktop.

Select an option

Save bogsio/7203447 to your computer and use it in GitHub Desktop.
...
from djorm_pgfulltext.models import SearchManager
from djorm_pgfulltext.fields import VectorField
...
class Post(models.Model):
"""
Django Model for a blog entry
"""
title = models.CharField(max_length=250)
body = models.TextField(blank=True)
search_index = VectorField()
objects = models.Manager()
search_manager = SearchManager(
fields=('title', 'body'),
config='pg_catalog.english',
search_field='search_index',
auto_update_search_field=True
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment