2014-05-11 22:14:48 +02:00
|
|
|
Xapian backend for Django-Haystack
|
|
|
|
==================================
|
2010-01-16 16:31:38 +01:00
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
.. _Travis: https://travis-ci.org/notanumber/xapian-haystack
|
|
|
|
|
2014-05-13 20:25:13 +02:00
|
|
|
.. image:: https://travis-ci.org/notanumber/xapian-haystack.svg?branch=master
|
|
|
|
:target: https://travis-ci.org/notanumber/xapian-haystack
|
2014-05-11 22:14:48 +02:00
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
Xapian-haystack is a backend of `Django-Haystack <http://haystacksearch.org/>`_
|
|
|
|
for the `Xapian <http://xapian.org>`_ search engine.
|
|
|
|
Thanks for checking it out.
|
|
|
|
|
|
|
|
You can find more information about Xapian `here <http://getting-started-with-xapian.readthedocs.org>`_.
|
2014-05-11 22:14:48 +02:00
|
|
|
|
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
Features
|
|
|
|
--------
|
2014-05-11 22:14:48 +02:00
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
Xapian-Haystack provides all the standard features of Haystack:
|
2014-05-11 22:14:48 +02:00
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
- Weighting
|
|
|
|
- Faceted search (date, query, etc.)
|
|
|
|
- Sorting
|
|
|
|
- Spelling suggestions
|
2010-01-16 16:31:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
Requirements
|
|
|
|
------------
|
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
- Python 2.4+ (Python 3.3 not support `yet <http://trac.xapian.org/ticket/346>`_).
|
2014-05-11 22:14:48 +02:00
|
|
|
- Django 1.5+
|
2012-04-20 20:53:06 +02:00
|
|
|
- Django-Haystack 2.0.X
|
2014-05-11 22:14:48 +02:00
|
|
|
- Xapian 1.0.13+
|
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
In particular, this we build this backend on `Travis`_ using:
|
2010-01-16 16:31:38 +01:00
|
|
|
|
2014-05-11 22:14:48 +02:00
|
|
|
- Python 2.7.6
|
|
|
|
- Django 1.6.4
|
|
|
|
- Django-Haystack (latest)
|
|
|
|
- Xapian 1.2.8 (libxapian22)
|
|
|
|
|
2010-01-16 16:31:38 +01:00
|
|
|
|
|
|
|
Installation
|
|
|
|
------------
|
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
First you need to install Xapian in your machine.
|
|
|
|
We recommend installing it on the virtual environment using
|
|
|
|
`this gist <https://gist.github.com/jleclanche/ea0bc333b20ef6aa749c>`_:
|
|
|
|
activate the virtual environment and run the script.
|
2014-05-11 22:14:48 +02:00
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
You can test if the installation was successful by running::
|
2010-01-16 16:31:38 +01:00
|
|
|
|
2014-05-11 22:14:48 +02:00
|
|
|
python -c "import xapian"
|
2010-01-16 16:31:38 +01:00
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
Finally, install Xapian-Haystack by running::
|
2012-04-20 20:53:06 +02:00
|
|
|
|
2014-05-13 21:07:14 +02:00
|
|
|
pip install git+https://github.com/notanumber/xapian-haystack.git
|
2010-01-16 16:31:38 +01:00
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
|
2014-05-11 22:14:48 +02:00
|
|
|
Configuration
|
|
|
|
-------------
|
2010-01-16 16:31:38 +01:00
|
|
|
|
2014-05-11 22:14:48 +02:00
|
|
|
Xapian is configured as other backends of Haystack.
|
2014-05-17 21:38:51 +02:00
|
|
|
You have to define the connection to the database,
|
|
|
|
which is done to a path to a directory, e.g::
|
2012-04-20 20:53:06 +02:00
|
|
|
|
|
|
|
HAYSTACK_CONNECTIONS = {
|
|
|
|
'default': {
|
2014-05-16 23:54:42 +02:00
|
|
|
'ENGINE': 'xapian_backend.XapianEngine',
|
2012-04-20 20:53:06 +02:00
|
|
|
'PATH': os.path.join(os.path.dirname(__file__), 'xapian_index')
|
|
|
|
},
|
|
|
|
}
|
2010-01-16 16:31:38 +01:00
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
The backend has the following optional settings:
|
2011-03-26 02:38:51 +01:00
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
- ``HAYSTACK_XAPIAN_LANGUAGE``: the stemming language; the default is `english` and the list of available languages
|
|
|
|
can be found `here <http://xapian.org/docs/apidoc/html/classXapian_1_1Stem.html>`_.
|
2011-06-13 22:37:29 +02:00
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
- ``HAYSTACK_XAPIAN_WEIGHTING_SCHEME``: the weighting scheme used for documents;
|
|
|
|
the default is `BM25 <https://en.wikipedia.org/wiki/Okapi_BM25>`_ but others can be chosen from
|
|
|
|
`this list <http://getting-started-with-xapian.readthedocs.org/en/latest/howtos/weighting_scheme.html>`_.
|
2011-06-13 22:37:29 +02:00
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
- ``HAYSTACK_XAPIAN_FLAGS``: the options used to parse `AutoQueries`;
|
|
|
|
the default is ``FLAG_PHRASE | FLAG_BOOLEAN | FLAG_LOVEHATE | FLAG_WILDCARD | FLAG_PURE_NOT``
|
|
|
|
See `here <http://xapian.org/docs/apidoc/html/classXapian_1_1QueryParser.html>`_ for more information
|
|
|
|
on what they mean.
|
2011-03-26 02:38:51 +01:00
|
|
|
|
2012-04-20 22:10:43 +02:00
|
|
|
|
2010-01-16 16:31:38 +01:00
|
|
|
Testing
|
|
|
|
-------
|
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
Xapian-Haystack has a test suite in continuous deployment in `Travis`_. The script ``.travis.yml`` contains
|
|
|
|
all the steps required to run the test suite.
|
|
|
|
|
|
|
|
Other way is to clone `Django-Haystack <https://github.com/toastdriven/django-haystack>`_,
|
|
|
|
copy the content of the ``tests/`` folder of Xapian-Haystack to the ``tests/`` folder of Haystack,
|
|
|
|
and copy ``xapian_backend.py`` to ``haystack/backends/`` folder.
|
|
|
|
|
|
|
|
The tests can then be run from the folder ``tests/`` using::
|
|
|
|
|
|
|
|
django-admin.py test --settings=xapian_settings xapian_tests
|
|
|
|
|
2010-01-16 16:31:38 +01:00
|
|
|
|
|
|
|
Source
|
|
|
|
------
|
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
The source code can be found in `github <http://github.com/notanumber/xapian-haystack/>`_.
|
2014-05-11 22:14:48 +02:00
|
|
|
|
2010-01-16 16:31:38 +01:00
|
|
|
|
|
|
|
Credits
|
|
|
|
-------
|
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
Xapian-Haystack is maintained by Jorge C. Leitão;
|
|
|
|
`David Sauve <mailto:david.sauve@bag-of-holding.com>`_ was the main contributor of Xapian-Haystack and
|
|
|
|
Xapian-Haystack was originally funded by `Trapeze <http://www.trapeze.com>`_.
|
|
|
|
|
2010-01-16 16:31:38 +01:00
|
|
|
|
|
|
|
License
|
|
|
|
-------
|
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
Xapian-haystack is free software licenced under GNU General Public Licence v2 and
|
|
|
|
Copyright (c) 2009, 2010, 2011, 2012 David Sauve, 2009, 2010 Trapeze, 2014 Jorge C. Leitão.
|
|
|
|
It may be redistributed under the terms specified in the LICENSE file.
|
2010-01-16 16:31:38 +01:00
|
|
|
|
|
|
|
Questions, Comments, Concerns:
|
|
|
|
------------------------------
|
|
|
|
|
2014-05-17 21:38:51 +02:00
|
|
|
Feel free to open an issue `here <http://github.com/notanumber/xapian-haystack/issues>`_
|
2014-05-11 22:14:48 +02:00
|
|
|
or pull request your work.
|
|
|
|
|
|
|
|
You can ask questions on the django-haystack `mailing list <http://groups.google.com/group/django-haystack/>`_
|
2014-05-17 21:38:51 +02:00
|
|
|
or in the irc ``#haystack``.
|