[Xapian-discuss] Exclude field in query

Olly Betts olly at survex.com
Tue Feb 14 10:47:08 GMT 2006


On Mon, Feb 13, 2006 at 03:15:21PM +0200, David Levy wrote:
> I wonder if it is possible to exclude a certain field in a probabilistic
> query.
> For instance, I want to search a term in all my indexed fields *but* in the
> "description" field, which is too large and not so interesting for this very
> query.

What you need to do is decide which field or fields map to a particular
term prefix.

So if you want to be able to search "all fields but description", you
need to generate terms with prefix <X> from all fields except
description.  Note that <X> may be empty (that's all the fields you
want to search by default).

It's also possible you could generate terms from each field separately
(or for particular groups of fields) and OR them at query generation
time, but the QueryParser class doesn't support that at present.

> Maybe I should create another xapian database without this description field
> ....?

It's probably better to just add it to the same database with a
different prefix.  That way you don't have a duplicate the record
table, etc.

Cheers,
    Olly



More information about the Xapian-discuss mailing list