[Xapian-discuss] Query::Query() in PHP, also QueryParser::prefixes

James Aylett james-xapian@tartarus.org
Wed, 26 May 2004 23:19:07 +0100


On Wed, May 26, 2004 at 10:54:35PM +0100, Francis Irving wrote:

> Just tried to do some query building in PHP but came up against a
> brick wall.  The only constructor exposed by SWIG is the first one.
> SWIG doesn't seem to support operator overloading of constructors.

It doesn't for PHP4, no. We have a plan to resolve this (and hence make
the PHP4 bindings more useful).
 
> I've attempted to fix this by modifying xapian.i.  I can't get the
> %rename clause to work for a constructor.

It's now called %name, I think. I've managed to get it working for
constructors in the past, but admittedly not for a while.

> I can make another function which returns "new Xapian::Query", but
> I'm worried about memory leaks since I don't understand how SWIG
> handles pointers.

"Magically".
 
> Similarly, the member variable QueryParser::prefixes isn't available.
> it should probably be a function call anyway.

No, it's fine as a member. I'm having a quick (modulo recompile time,
sigh) play to see if this can be wrapped conveniently, along with the
other missing bits of the interface.
 
> Either way I'm stuck and will have to resort to piping to Perl again
> soon... ;(

Eww. You may be able to do something with the query server that
Richard put into CVS a while back - don't know quite what state it's
in, though.

J

-- 
/--------------------------------------------------------------------------\
  James Aylett                                                  xapian.org
  james@tartarus.org                               uncertaintydivision.org