This post is about whoosh as haystack backend, there are several backends to be used like: xapian which is written in c++, also java solr, elasticsearch...
Whoosh is a fast, featureful full-text indexing and searching library implemented in pure Python, in addition Every part of how Whoosh works can be extended or replaced to meet your needs exactly.
as described in the docs:
Whoosh might be useful in the following circumstances:
- Anywhere a pure-Python solution is desirable to avoid having to build/compile native libraries (or force users to build/compile them).
- As a research platform (at least for programmers that find Python easier to read and work with than Java ;)
- When an easy-to-use Pythonic interface is more important to you than raw speed.
You can download the source from https://github.com/saady/whoosh_demo
let's create an app and call it "search".
In your settings files:
Our search engine is going to help me to organize, index, and retrieve my gutenberg favorite books, therefore
my models are:
Inside my app "search" I well add a file
That helps in handling my data about books and authors
My favorite book is Flatland by Edwin Abbott Abbott,
which is available on http://www.gutenberg.org/ebooks/97.
now create those text files and add the attached tags (I am assuming that your templates are inside templates directory)
now lets build the index:
now you have your index files.
Lets create a search.html page, where we can search for authors or books
Now navigate to
and start making your search queries.