/django-haystack-algolia

An algolia.com backend for Django apps using on Haystack 2.x

Primary LanguagePythonBSD 2-Clause "Simplified" LicenseBSD-2-Clause

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:

  • Indexing your models for first time. Each model instances get indexed in a separate Algolia's index in order to use certain Algolia optimizations
  • Updating indexes
  • Clearing indexes
  • Removing one object from its index
  • Searching models

TODO

Haystack features:

In general:

  • tests

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.