Code


Version 1 (modified by bbeck, 8 years ago) (diff)

--

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):

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,
                        text_fields=['Person.biography'],
                        {'first': 'Person.first_name',
                         'last': 'Person.last_name'})
indexer.update()
indexer.search("brian -last:beck", order_by='last_name')

Current Status

Merquery is in a working state but needs some polish.

LuceneIndexer currently works fine and is about 90% complete. XapianIndexer and HypeIndexer are not yet fully functional, they are about 50% complete.