Yoann Maheo
2011-Feb-11 16:55 UTC
[Xapian-discuss] PHP Binding and SWIG Director for XapianMatchDecider
Hi, I try to use XapianMatchDecider to filtering results, but the code : $Decider = new MatchDecider_Search($XapianDatabase->_cPtr); $mset = $XapEnquire->get_mset(0, 3000, null, $Decider); Always return : PHP Fatal error: No matching function for overloaded 'Enquire_get_mset' in xapian.php on line 1082 I saw that SWIG was not supporting Directors for PHP, but now, it seems to be patched. Why is it still not working ? Do you have a work arround ? Thanks Yoann Maheo
Andrew Betts
2011-Feb-12 13:02 UTC
[Xapian-discuss] PHP Binding and SWIG Director for XapianMatchDecider
> I try to use XapianMatchDecider to filtering results, but the code : > $Decider = new MatchDecider_Search($XapianDatabase->_cPtr); > $mset = $XapEnquire->get_mset(0, 3000, null, $Decider); > > Always return : > PHP Fatal error: No matching function for overloaded 'Enquire_get_mset' > in xapian.php on line 1082Hi Yohann, I use the PHP bindings too, and this error is a common one that normally means you have attempted to invoke a method with an invalid combination of argument types. The documentation for get_mset seems to suggest that if you are going to include a matchdecider argument you also need an RSet value before it. http://xapian.org/docs/apidoc/html/classXapian_1_1Enquire.html#edb5fb761acc0bb2249bec375883a093 I'm also unsure whether null is a valid value to pass in the checkatleast argument. Since you want up to 3000 results, you might want to set that value to some number higher than 3000. Hope this is of some help.
Olly Betts
2011-Feb-16 12:30 UTC
[Xapian-discuss] PHP Binding and SWIG Director for XapianMatchDecider
On Fri, Feb 11, 2011 at 05:55:30PM +0100, Yoann Maheo wrote:> I try to use XapianMatchDecider to filtering results, but the code : > $Decider = new MatchDecider_Search($XapianDatabase->_cPtr);You shouldn't be accessing _cPtr explicitly yourself - it's a SWIG implementation detail, and might change in the future.> $mset = $XapEnquire->get_mset(0, 3000, null, $Decider); > > Always return : > PHP Fatal error: No matching function for overloaded 'Enquire_get_mset' > in xapian.php on line 1082This doesn't work because subclassing Xapian classes in PHP isn't currently supported, so your $Decider object isn't a XapianMatchDecider as far as SWIG is concerned.> I saw that SWIG was not supporting Directors for PHP, but now, it seems > to be patched.SWIG now supports it, but I've not yet managed to get this to work with Xapian. This is the ticket: http://trac.xapian.org/ticket/488> Why is it still not working ? Do you have a work arround ?Sorry, there isn't really a workaround, other than avoid needing to subclass MatchDecider, etc, or use a different language instead of PHP. On Sat, Feb 12, 2011 at 02:15:23PM +0100, Yoann Maheo wrote:> "The only remaining issue seems to be that SWIG's PHP director support > doesn't handle directed methods which take an object as a parameter - the > subclassed method gets a PHP resource without its object wrapper."> I would like to know if this bug is fixed and if PHP Director can be > actived in Xapian binding.As far as I'm aware, this isn't fixed yet. Cheers, Olly