[Xapian-discuss] PHP Bindings

James Aylett james-xapian at tartarus.org
Wed Sep 8 10:40:30 BST 2004


On Wed, Sep 08, 2004 at 02:32:16AM +0100, Olly Betts wrote:

> * simplesearch.php and simpleindex.php now load the xapian PHP extension
>   using: dl('xapian.so');
> 
> Questions:
> 
> Is the last fix actually what we should be doing?  How did you run these
> scripts, James?  Using php.ini?

I added extension=php_xapian.so to php.ini, but you can equally do it
with -d extension=php_xapian.so to the php CLI binary.

> There's a more elaborate version here which takes care of the extension
> already being loaded and also works on Windows (though probably not on
> some other UNIX platforms - they don't all use .so for shared objects):
> 
> http://www.php.net/manual/en/function.dl.php

I think the examples should assume the invocation will load the .so,
personally.

> We should really add a "Xapian_" prefix to everything - as it is we
> rather pollute the namespace, and prefixing like this is the norm for
> php (e.g.  MySQL is wrapped as mysql_*).  Anyone know how to do this
> with SWIG?  For Tcl, swig has a -prefix option, but not for php4.

I was unable to find a way of doing it, but ISTR Sam saying something
about it.

> Also, why do we rename empty methods to is_empty?  PHP4 has a built in
> function called empty, but since we prefix methods with the class name,
> MSet::empty() would become MSet_empty() anyway.
>
> We also rename empty to is_empty for the Python bindings, but again
> for no reason I can see: Python's Queue class has an empty() method, so
> it seems unlikely we can't...

Pass. Looks like I made that change, when I made the Python bindings
work with Py2.2 ... no idea why. Feel free to change it, I guess ...
 
> And a bonus question: why does the C++ API have Query::is_empty()?
> I think for consistency we should probably add Query::empty() and
> deprecate Query::is_empty()...

+1. Although empty() sounds like a verb for any collections (Database,
particularly). is_empty() is clearly a test. That may not be terribly
important though.

J

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



More information about the Xapian-discuss mailing list