Toast Driven

← Back to April 15, 2009

Announcing Haystack - Modular search for Django

Search has long been a slightly painful affair within the Django community. There have been numerous attempts at search, each with a different API and feature set. People who are new to the community have no easy/obvious option and switching to a different search engine can be a painful experience.

Long frustrated by this situation, I've been working on a solution since the beginning of this year. It's called Haystack.

What is Haystack?

Haystack is a modular search framework for Django. It works directly with Django Models and provides a familiar API to people who are comfortable with Django. It features:

  • Pluggable backends (Solr & Whoosh to start with, with more in the works)
  • A familiar API to that resembles Django where appropriate
  • Easy integration with third party applications
  • A loosely coupled architecture that allows for parts to be interchanged
  • Documentation
  • Test coverage

Further, where backends support it, it also features:

  • Automatic query generation
  • Term boosting
  • "More Like This"
  • Faceting
  • Highlighting

How complete is Haystack?

Haystack is in a late beta phase. We can't promise backward compatibility right now. That said, most of Haystack has been extremely stable since the end of February. I'd like to do a beta period with more people hammering on it and get some feedback. I also intend to further flesh out documentation and implement a Lucene backend before all the 1.0 features are complete. The Solr backend is very stable and suitable for medium-to-large deployments. The Whoosh backend is very promising (pure Python!) and suitable for small setups. As it matures, it will become even better.

Why Haystack?

Perhaps you'd like to have a customized search that fits your users better than Google/Yahoo/MSN. Or you'd like to selectively enable searching on an aspect of your site. You might also want an advanced feature, like suggestions via "More Like This" or faceting.

Further, it's true there is a myriad of options out there. This is one reason to use Haystack, as it is an attempt to unify many of these different options in a standard syntax.

Haystack also plays nicely with third-party apps, so there's no need to fork someone else's app just to add search capabilities.

Where can I get Haystack?

For now, Haystack is hosted on GitHub, so you can either clone it or download a tarball. Setup is relatively simple and is detailed in the tutorial.

You'll probably want to start with the Tutorial then move on the the rest of the API documentation from there.

Haystack is MIT licensed, so you may feel free to use it (or portions of it's code) in any project you need.

Getting Involved

There's a mailing list as well as an IRC channel (#haystack on I'm still working on trying to find a bug/issue tracker.

If you want to help out with development, please feel free to fork the project on GitHub or submit patches.

Toast Driven