[Xapian-discuss] PHP Fatal error while indexing Wikipedia

James Aylett james-xapian at tartarus.org
Fri Jan 4 01:07:11 GMT 2008


On Fri, Jan 04, 2008 at 12:21:53AM +0000, Robert Young wrote:

> $mset = $enquire->get_mset(0, 10);
> $i = new PHPXapianMSetIterator($mset);
> foreach ($i as $match) {
>   echo $match->get_document()->get_data() . "\n";
> }
> 
> Is this the only feasable way to do this or would it be possible to
> submit a patch on the xapian.php file itself? I would ideally like to
> be able to do something like
> 
> $mset = $enquire->get_mset(0, 10);
> foreach ($mset as $match) {
>   echo $match->get_document()->get_data() . "\n";
> }
> 
> It's only one line less but I think it's a lot more intuitive.

We do something akin to the latter in the python bindings, for exactly
what reason. You should be able to use something like #pragma(php4)
code="..." to inject PHP code into the final wrapper. If you put it in
(I think) extra.i inside the php directory, it should do the right
thing. The question then is whether you can augment things
appropriately in PHP5.

(Note that it's #pragma(php4) even for PHP5, according to
<http://www.swig.org/Doc1.3/Php.html#Php_nn2_7>.)

J

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



More information about the Xapian-discuss mailing list