Skip to main content

A Xapian backend for Haystack

Project description

https://travis-ci.org/notanumber/xapian-haystack.svg?branch=master https://coveralls.io/repos/notanumber/xapian-haystack/badge.svg?branch=master&service=github

Xapian-haystack is a backend of Django-Haystack for the Xapian search engine. Thanks for checking it out.

You can find more information about Xapian here.

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.7 or 3.3

  • Django 1.6+

  • Django-Haystack 2

  • Xapian 1.2.19+

In particular, we build this backend on Travis using:

  • Python 2.7 and 3.3

  • Django 1.6, 1.7 and 1.8

  • Django-Haystack (master)

  • Xapian 1.2.19 (in Python 2) and 1.3.3 (in both)

Installation

First, install Xapian in your machine e.g. with the script provided, install_xapian.sh. Call it after activating the virtual environment to install:

source <path>/bin/activate
./install_xapian.sh <version>

<version> must be >=1.3.0 for Python 3 envs. This takes around 10 minutes.

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.

  • HAYSTACK_XAPIAN_WEIGHTING_SCHEME: a tuple with parameters to be passed to the weighting scheme 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 for more information on what they mean.

  • HAYSTACK_XAPIAN_STEMMING_STRATEGY: This option lets you chose the stemming strategy used by Xapian. Possible values are STEM_NONE, STEM_SOME, STEM_ALL, STEM_ALL_Z, where STEM_SOME is the default. See here for more information about the different strategies.

Testing

Xapian-Haystack has a test suite in continuous deployment in Travis. The script .travis.yml contains the steps required to run the test suite.

Source

The source code can be found in github.

Credits

Xapian-Haystack is maintained by Jorge C. Leitão; David Sauve was the main contributor of Xapian-Haystack and Xapian-Haystack was originally funded by Trapeze. 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 or pull request your work.

You can ask questions on the django-haystack mailing list: or in the irc #haystack.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xapian-haystack-2.0.0.tar.gz (24.4 kB view details)

Uploaded Source

File details

Details for the file xapian-haystack-2.0.0.tar.gz.

File metadata

File hashes

Hashes for xapian-haystack-2.0.0.tar.gz
Algorithm Hash digest
SHA256 0d36a48a53de418adc1b01d846eba4cb04489a2fd0f88819ec763bfd2a7f781c
MD5 be461460061a460ca18ba97e6efa1b7e
BLAKE2b-256 7b3986f680fe9b76c7c6c206a768f7639e6da9cebd7aeb3c21082900f5fc4740

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page