How to use

Follow these simple steps:

  1. Declare your TextField and CharField as FulltextTextField and FulltextCharField respectively:

    from django.db import models
    from mysql_search.models import (FulltextTextField, FulltextCharField,
    class Message(models.Model):
        title = FulltextCharField(max_length=160, default='')
        content = FulltextTextField(default='')
  2. You can either use an included object manager SearchManager or use Django search field lookup. To use the object manager, add it to your model:

        objects = SearchManager(['title'])

    search field lookup:

  3. Then query with either:

    Message.objects.filter(title__search='mysql') # BOOLEAN MODE

    Or when your object manager is SearchManager:'mysql') # NATURAL LANGUAGE
  4. Set SOUTH_DATABASE_ADAPTERS for your database to mysql_search.south. This is done in your file:

        'default': 'mysql_search.south'
  5. Convert your application to use South. Please read South's documentation for how to do this step.

    South's documentation:


This only works with MySQL.

This only works with MyISAM tables. When migration is run, the tables will be silently converted to MyISAM. If you need InnoDB, create a different model just to hold fulltext indexes.


Copyright 2013 Nam T. Nguyen

Distributed under the terms of the BSD license.