A Xapian backend for Haystack
Find a file
antlord 1ea3549d68 Fixed #117 -- Added support for EdgeNgram and Ngram.
Docstring has been updated

tests has been created

some corrects of unusable imports

Fixes created after notices in pull request.

class of mock has been fixed, test of indexation edge ngram has been created

big cycle has been separated to generator

fix depencies

tests has been updated

some refactoring and generator of edge ngram terms has been updated

Package "six" has been removed from requirements, class with edge ngram
field has been created. Edge ngram field has been removed from another
mocks. Indexation for this class has been splitted to separate class.

unimportant tests has been removed

both techniques, ngram and edge ngram, has been implemeted

little refactoring

some minor fixes
2014-12-30 18:21:42 +01:00
tests Fixed #117 -- Added support for EdgeNgram and Ngram. 2014-12-30 18:21:42 +01:00
.gitignore Updated .gitignore to ignore MANIFEST 2009-12-07 11:14:17 -05:00
.travis.yml Merged two commands in travis conf. 2014-09-11 18:46:34 +02:00
AUTHORS Updated narrow_queries in backend search to AND queries rather than OR. Thanks to naktinis for the original patch. 2012-05-28 16:06:07 -07:00
LICENSE Switched license back to GPL v2. 2011-07-14 15:52:03 -07:00
MANIFEST.in Updated MANIFEST.in to include README.rst 2010-01-29 10:58:48 -05:00
README.rst Fixed #117 -- Added support for EdgeNgram and Ngram. 2014-12-30 18:21:42 +01:00
requirements.txt Removed unnecessary requirement and bumped Django version. 2014-09-11 18:58:45 +02:00
setup.py Updated narrow_queries in backend search to AND queries rather than OR. Thanks to naktinis for the original patch. 2012-05-28 16:06:07 -07:00
xapian_backend.py Fixed #117 -- Added support for EdgeNgram and Ngram. 2014-12-30 18:21:42 +01:00

Xapian backend for Django-Haystack
==================================

.. _Travis: https://travis-ci.org/notanumber/xapian-haystack

.. image:: https://travis-ci.org/notanumber/xapian-haystack.svg?branch=master
   :target: https://travis-ci.org/notanumber/xapian-haystack

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>`_.


Features
--------

Xapian-Haystack provides all the standard features of Haystack:

- Weighting
- Faceted search (date, query, etc.)
- Sorting
- Spelling suggestions
- EdgeNGram and Ngram (for autocomplete)

Requirements
------------

- Python 2.4+ (Python 3.3 not support `yet <http://trac.xapian.org/ticket/346>`_).
- Django 1.5+
- Django-Haystack 2.0.X
- Xapian 1.0.13+

In particular, we build this backend on `Travis`_ using:

- Python 2.7.6
- Django 1.6.4
- Django-Haystack (latest)
- Xapian 1.2.8 (libxapian22)


Installation
------------

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.

You can test if the installation was successful by running::

    python -c "import xapian"

Finally, install Xapian-Haystack by running::

    pip install git+https://github.com/notanumber/xapian-haystack.git


Configuration
-------------

Xapian is configured as other backends of Haystack.
You have to define the connection to the database,
which is done to a path to a directory, e.g::

    HAYSTACK_CONNECTIONS = {
        'default': {
            'ENGINE': 'xapian_backend.XapianEngine',
            'PATH': os.path.join(os.path.dirname(__file__), 'xapian_index')
        },
    }

The backend has the following optional settings:

- ``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>`_.

- ``HAYSTACK_XAPIAN_WEIGHTING_SCHEME``: a tuple with parameters to be passed to the weighting scheme
  `BM25 <https://en.wikipedia.org/wiki/Okapi_BM25>`_.
  By default, it uses the same parameters as Xapian recommends; this setting allows you to change them.

- ``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.


Testing
-------

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


Source
------

The source code can be found in `github <http://github.com/notanumber/xapian-haystack/>`_.


Credits
-------

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>`_.
`ANtlord <https://github.com/ANtlord>`_ implemented support for EdgeNgram and Ngram.


License
-------

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.

Questions, Comments, Concerns:
------------------------------

Feel free to open an issue `here <http://github.com/notanumber/xapian-haystack/issues>`_
or pull request your work.

You can ask questions on the django-haystack `mailing list <http://groups.google.com/group/django-haystack/>`_
or in the irc ``#haystack``.