[Xapian-discuss] query within value range
Olly Betts
olly at survex.com
Tue Jun 5 19:22:14 BST 2007
On Tue, Jun 05, 2007 at 06:35:27PM +0100, Mark Clarkson wrote:
> On Tue, 2007-06-05 at 16:34 +0100, Richard Boulton wrote:
> > When the query parser find something which looks like a range, each
> > ValueRangeProcessor is called (in the order they're added to the query
> > parser) and can decide to accept the range (in which case it returns the
> > start and end values, so it can do marshalling to make the values into
> > fixed-width number representations, for example), or reject the range,
> > in which case the next processor is called.
> >
> > So, you could have a date range processor, which accepts ranges which
> > look like dates, and a numeric processor, which accepts ranges which don't.
The NumberValueRangeProcessor also allows checking for a suffix or
prefix, so you can (once the design bug is fixed) chain several of them
to allow $10..100 and 5..15kg to be recognised at the same time.
> Okay, that's pretty darn cool. So I've currently got a value(0) that is
> a date but it's date/time, '20070604175403', and since this is a number
> (and after a quick peek I think it doesn't look like a date to the
> DateValueRangeProcessor) I could use the NumberValueRangeProcessor. Also
> since these order correctly when string sorted I should not hit the
> soon-to-be-eradicated number value bug. About right?
I would recommend avoding NumberValueRangeProcessor currently - instead
just make your own ValueRangeProcessor subclass which does what you
want. Or suggest a patch for DateValueRangeProcessor if it's possible
to cleanly extend it to handle your case.
> So for making the programmers life that much easier is the performance
> expected to be better or worse than boolean when using a value
> processor?
A single boolean filter term (such as Ttext/html) will almost certainly
be faster than checking a value. But using a value probably compares
favourably to using multiple boolean terms to implement date ranges
(like Omega does by default).
Cheers,
Olly
More information about the Xapian-discuss
mailing list