[Xapian-discuss] "Using document values in search"

Olly Betts olly at survex.com
Sat Apr 21 17:58:26 BST 2007


On Sat, Apr 21, 2007 at 03:41:36PM +0300, Daniel Andersson wrote:
> Just tried to work out how to do price, timestamp and similar
> searches (ie price between 123 and 248, not pre-defined ranges) and
> found
> http://lists.tartarus.org/pipermail/xapian-discuss/2006-August/002544.html
> 
> Not that long ago, but I'm hoping that this problem has been
> addressed in the PHP implementation. Am I right or am I hoping for
> too much? :)

It hasn't been addressed.  The problem is that SWIG doesn't support what
it calls "directors" for PHP, which are required to handle the callback
behaviour here (C++ code needs to be able to call into PHP for the
virtual methods on the PHP subclass of MatchDecider).

It looks like it would be possible to implement directors for PHP in
SWIG, but nobody has done the work yet.

However, Xapian SVN HEAD has Xapian::ValueRangeProcessor, which allows
these sort of range searches to be implemented very easily.  It's all
integrated with the QueryParser class, so you can set things up so that
the user can just enter the range as part of their query string (the
syntax used is `start..end', in common with a number of other search
engines which support range searches).

This comes with some predefined subclasses, which allow handling of
date, number (with a prefix or suffix), and string ranges - e.g.
`$123..248', `02/04/2007..21/04/2007', `5..12kg', etc without having to
create your own subclasses.

Cheers,
    Olly



More information about the Xapian-discuss mailing list