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

Francis Irving francis@flourish.org
Wed, 26 May 2004 22:54:35 +0100


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.

I can make a query with one term
    $query1 = new_query("hello");
But trying to build one query from another doesn't work:
    $query = new_query(Query_OP_OR, $query1, $query2);

When building the xapian bindings there are lots of warnings like this:
./../xapian.i:407: Warning(502): Previous declaration is
Xapian::Query::Query(string const &,termcount,termpos)

I've attempted to fix this by modifying xapian.i.  I can't get the
%rename clause to work for a constructor.  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.

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

Either way I'm stuck and will have to resort to piping to Perl again
soon... ;(

Francis
-- 
Undemocratic Europe.  Fix it.  Vote Martin Bell.  http://www.bellforeurope.org.uk