API for full-text search in Django

Let me imagine a way I’d like to use a full-text search in Django. It would look like this:

class Person(models.Model):
….first_name = models.CharField(maxlength = 50)
….about = models.TextField()
….class TextSearch:

# This would return a QuerySet
people = Person.objects.search(“Miles Davis”)

That’s it.

The inner class “TextSearch” would take optional arguments like the list of fields to be indexed. All fields would be indexed by default.

I am aware of already existing projects which provide search capabilities to Django.

  • Mercurytide uses MySQL-specific functions, so it wouldn’t work for other database backends.
  • Merquery doesn’t seem to have a nice API. For example, a system path is needed to initialize an indexer.

Any other search engines out there for Django?

Author: automatthias

You won't believe what a skeptic I am.

One thought on “API for full-text search in Django”

  1. This has been a pain point for me too. At the moment I’m planning on using the Mercurytide’s little MySQL thingy but I really hope the contrib.search (aka Merquery) branch gets finished. I don’t really see a big problem with the api. I tried checking it out though and it broke when I tried to do anything and the branch was missing lots of newer Django stuff. I think contrib.search has been abandoned by the initial guy (as in, it’s old and he hasn’t written anything about it on his blog for ages). I would offer to maintain the branch but I don’t know a lot about fulltext searching and I’m not sure if I have the time.

Comments are closed.

%d bloggers like this: