This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Implementation PostgeSQL for Full Text Search for django 1.7, taking advantage of new features Migrations and Custom Lookups.


- FieldLookup's search, isearch, tsquery

- Ranking support with normalization, and weights using annotations

- Migrations classes to help create and remove index's, support for 'gin' or 'gist'

- Migrations classes to help create and remove of trigger's

- Multiple dictionaries support with trigger and FieldLookup's

- Support for python 2.7, 3.3 and 3.4

With multiple dictionary support, index and trigger migrations

How it works

For a existing model::

class Article(models.Model):
title = models.CharField(max_length=255)
article = models.TextField()

You want to have full text search in fields title and article, and make give weight to title of 'A'.

Import TSVectorField::

from pg_fts.fields import TSVectorField

Add to existing TSVectorField to model and tell the fields that you want to index and the dictionary::

fts = TSVectorField(fields=(('title', 'A'), 'article'), dictionary='english')

Create migrations file::

python makemigrations article

Open the new created migration and import CreateFTSIndexOperation, CreateFTSTriggerOperation, UpdateVectorOperation::

from pg_fts.migrations import (CreateFTSIndexOperation, CreateFTSTriggerOperation,

And add to the end of operations::

# update vector for already existing data
# create trigger for automatic insert and update vector
# create gin index for vector

Make the changes to your database::

python migrate article

Now you have a full text search performance with a trigger that checks any changes in the tracked fields and updates vector field.

You can search will match all words:

>>> Article.objects.filter(fts__search='waz up')

Will result in sql something like:

.. code-block:: sql

tsvector @@ to_tsquery('english', 'waz & up')

Or isearch will match some words:

>>> Article.objects.filter(fts__isearch='waz up')

Will result in sql something like:

.. code-block:: sql

tsvector @@ to_tsquery('english', 'waz | up')

But you can make a raw tsquery:

>>> Article.objects.filter(fts__tsquery='waz & !up')

Will result in sql something like:

.. code-block:: sql

tsvector @@ to_tsquery('english', 'waz & !up')

And also rank the results with normalization and order:

>>> from pg_fts.ranks import FTSRank
>>> Article.objects.filter(
rank=FTSRank(fts_search='waz up', normalization=[1,3])).order_by('-rank')

For multiple dictionaries and more advanced options, check the `documentation <>`_.


Documentation available in `Read The Docs <>`_


Clone from GitHub::

git clone git:// django-pg-fts

You should run the tests::


Or running tox for py27, py33, py34::


Install using pip from github::

pip install git+

Or using

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_pg_fts-0.1.1-py2.py3-none-any.whl (14.6 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Oct 2, 2014
django-pg_fts-0.1.1.tar.gz (28.4 kB) Copy SHA256 Checksum SHA256 Source Oct 2, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting