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

Francis Irving francis@flourish.org
Thu, 27 May 2004 16:38:44 +0100


On Wed, May 26, 2004 at 11:19:07PM +0100, James Aylett wrote:
> > 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.

Aha!  Thank you.  Much more success.  I've tried this.

%name(QueryCombine) Xapian::Query::Query(Xapian::Query::Query::op op_,
%const Xapian::Query::Query & left, const Xapian::Query::Query &
%right);

It makes a PHP function called query_querycombine.  Unfortunately,
the function takes a spurious extra Query argument as its first
parameter.  SWIG thinks it is a member function, rather than a
constructor.

$query = query_querycombine($querydummy, Query_OP_AND, $query1, $query2); 

It works though!

> It doesn't for PHP4, no. We have a plan to resolve this (and hence make
> the PHP4 bindings more useful).

Anything particular I can do to help?  I have to hack /something/ to
get things working over the next week, and I may as well hack even
a small thing in the format you expect.  Or else I'll make do with
query_querycombine above ;)

Francis