This section provides an overview of what django-haystack is, and why a developer might want to use it.
It should also mention any large subjects within django-haystack, and link out to the related topics. Since the Documentation for django-haystack is new, you may need to create initial versions of those related topics.
Version | Release Date |
---|---|
2.5.1 | 2016-10-28 |
2.5.0 | 2016-07-12 |
2.4.1 | 2015-10-29 |
2.4.0 | 2015-06-09 |
2.3.2 | 2015-11-11 |
2.3.1 | 2014-09-22 |
2.3.0 | 2014-09-19 |
2.2.1 | 2014-09-03 |
2.2.0 | 2015-08-03 |
2.1.0 | 2013-07-28 |
2.0.0 | 2013-05-12 |
pip install django-haystack
Add haystack
to your project's INSTALLED_APPS
inside of your settings.py
file:
# settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
# Put haystack with above your project's apps
'haystack',
'myproject_app',
]
Now add the settings for your search backend. Haystack currently supports: solr, elasticsearch, whoosh, and xapian.
Solr:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://127.0.0.1:8983/solr'
# ...or for multicore...
# 'URL': 'http://127.0.0.1:8983/solr/mysite',
},
}
Elasticsearch:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'haystack',
},
}
Whoosh:
import os
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
},
}
Xapian:
import os
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'xapian_backend.XapianEngine',
'PATH': os.path.join(os.path.dirname(__file__), 'xapian_index'),
},
}