[[TOC(inline)]] == Introduction == === Why do we need an abstraction layer for full-text indexing? === Developers often must implement search methods for their database, but unfortunately so far it has been easier to roll your own simple search than to deploy an existing project such as Lucene. Merquery provides an abstraction layer for popular text indexing engines and makes it easy for anyone to attach them to their database. == Using Merquery == You can enable Lucene indexing of a database table like so (assuming the library is in contrib.search): {{{ #!python from contrib.search.backends import LuceneIndexer class Person(models.Model): first_name = models.CharField(maxlength=30) last_name = models.CharField(maxlength=30) biography = models.TextField() indexer = LuceneIndexer('/tmp/person-index', Person, {'first': 'Person.first_name', 'last': 'Person.last_name'}, text_fields=['Person.biography'] ) indexer.update() indexer.search("brian -last:beck", order_by='last_name') }}} == Current Status == === Merquery === Are in a working state but needs some polish. === !XapianIndexer === Currently work fine and are about 90% complete. Note: You should see the ticket #2707 if you want use XapianIndexer. This backend also has a fork called [http://code.google.com/p/djapian/ Djapian] === !LuceneIndexer === Currently work fine and are about 90% complete. === !HypeIndexer === Are not yet fully functional; this is about 50% complete. More info from the author in [http://blog.case.edu/bmb12/2006/08/merquery_summer_of_code_results this blog post]. == Related Projects == * for those on postgres, it may be possible to kludge it together natively using [http://barryp.org/blog/entries/postgresql-full-text-search-django/postgres full-text indexes], even though only MySQL MyISAM is usually supported * lucene has a [http://pylucene.osafoundation.org/ python implementation] which could be brushed into shape * there is an actively maintained [http://code.google.com/p/django-sphinx/ handy wrapper] for [http://www.sphinxsearch.com/ sphinx] search which turns the index into a django ORM field, which looks very natural in django idiom