[Xapian-discuss] Design-question/problem

Olly Betts olly at survex.com
Sun Aug 30 05:55:43 BST 2009


On Fri, Aug 28, 2009 at 01:43:00PM +0100, James Aylett wrote:
> Hi, Carsten. As John points out, another way to approach this is to
> use a single database, and to add a single term to each document,
> identifying the book it came from.

You can also use a hybrid approach, with several databases, each
containing several books.  That might work particularly well if there
are common subsets which people want to search over.

> boolean_terms = [ 'XB1', 'XB2' ]
> qp = xapian.QueryParser()
> # ... configuration of qp (eg: stemming, prefixes)
> p_query = qp.parse_query(request.GET.get('q', ''))
> b_query = xapian.Query(xapian.Query.OP_AND, boolean_terms)

Note that you want OP_OR (and not OP_AND) here to match the term in
either book 1 or book 2.  With OP_AND, you'd never actually get any
matches...

Cheers,
    Olly



More information about the Xapian-discuss mailing list