[Xapian-discuss] How to search documents with certain values

Olly Betts olly at survex.com
Tue Jun 1 15:14:44 BST 2010


On Mon, May 24, 2010 at 10:06:17AM +0100, Abhinay Mehta wrote:
> I've tested it and can use Xapian::DateValueRangeProcessor by appending the
> range string: YYYYMMDD..YYYYMMDD to the user query myself.
> Not sure if that's too much of a cow-boy way of doing it.

That's a bad idea - don't try to adjust the user's query string, instead
apply a filter afterwards.  I even gave you the code in my earlier reply:

> > In C++, augment your query like so:
> >
> >    Xapian::Query filter(Xapian::Query::OP_VALUE_GE, threshold_value);
> >    query = Xapian::Query(Xapian::Query::OP_FILTER, query, filter);

> Also would anyone know about the performance difference between the two
> different methods?

The same, but applying the filter as I suggest doesn't risk tripping up the
query parser.

Cheers,
    Olly



More information about the Xapian-discuss mailing list