Home

Awesome

haystack-algolia

An Algolia backend for Haystack 2.x. Use Algolia service to index and search your django models.

INSTALLATION

First, go to https://www.algolia.com/ and create an account. Then create an index, you'll need it later.

Install haystack-algolia from github using pip:

pip install -e git+https://github.com/matagus/haystack-algolia.git#egg=dev

Then add to your settings.py:

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack_algolia.algolia_backend.AlgoliaEngine',
        'APP_ID': '<YOUR APP ID>',
        'API_KEY': '<YOUR API KEY>',
        'INDEX_NAME_PREFIX': 'production-',
        'TIMEOUT': 60 * 5
    }
}

Now you can use haystack as usual. Notice so far it only provides a few features:

TODO

Haystack features:

In general:

Notice that algolia.com does not support dinamically defined (per query) sort order, so using .order_by() in a haystack SearchQuerySet won't make any difference.

Also, filtering works in a pretty different way than in other haystack backends: if you do SearchQuerySet().models(MyModel).filter(field1="foo", field2="bar") it this backend will search for "foo bar" no matter in what fields it appears. I'll be working in providing a more accurate filtering feature using Algolia's filtering API.