[Xapian-discuss] PHP Fatal error while indexing Wikipedia

Robert Young bubblenut at gmail.com
Tue Jan 1 23:50:35 GMT 2008


> Which xapian-bindings version is this?  Line 1482 doesn't seem to match
> up with my tree.
1.0.4
The function is
  function index_text($text,$weight=1,$prefix=null) {
    switch (func_num_args()) {
    case 1: case 2:
TermGenerator_index_text($this->_cPtr,$text,$weight); break; // <--
line 1482
    default: TermGenerator_index_text($this->_cPtr,$text,$weight,$prefix);
    }
  }

> It sounds like either you're passing in parameters with the wrong type,
> or it's a bug in the wrappers SWIG is generating, but it's hard to know
> which without seeing your indexer code.  The generated code looks OK to
> me at least.
>
> My best guess is that maybe you are passing a string for the weight
> parameter in some case - as the documentation says:
>
> http://www.xapian.org/docs/bindings/php/
As you can see from the code above, it doesn't look like it can be
getting anything other than 1 or 2 for the weight. Also, about 150,000
documents go in without a problem before this one
in exactly the same way.

>     One thing to be aware of though is that SWIG implements dispatch
>     functions for overloaded methods based on the types of the
>     parameters, so you can't always pass in a string containing a number
>     (e.g. "42") where a number is expected as you usually can in PHP.
>     You need to explicitly convert to the type required - e.g. use (int)
>     to convert to an integer, (string) to string, (double) to a floating
>     point number.
Ahh, that may be something. If the field value is empty it may be null
rather than an empty string. I guess I shouldn't be indexing it either
way really. I won't get another chance to run this until tomorrow but
I'll let you know how it goes. Thanks for the pointer.

Cheers
Rob



More information about the Xapian-discuss mailing list