[Xapian-discuss] PHP set_bias and sorting in general

Olly Betts olly at survex.com
Mon Nov 8 17:03:13 GMT 2004

On Thu, Nov 04, 2004 at 01:22:01AM +0000, Francis Irving wrote:
> 1. I'm playing with set_bias from PHP, and get this error.
> Fatal error: Type error in argument 3 of Enquire_set_bias. Expected
> _p_time_t 
> The line of code is:
> enquire_set_bias($this->enquire, $weight, $halflife);

It appears SWIG doesn't know that it can just pass a number for time_t.
It probably wants a typemap entry, but you could try just changing the
prototype of Enquire::set_bias() in xapian-bindings/xapian.i to use
'unsigned long long' instead of time_t (or whatever the appropriate type
is on your OS).

> 2. While on the subject, any idea when you'll add a proper API for bias? 

I'm afraid I don't know.  It's on my list, but so are many other things.

> 3. Any advice on selecting the weight for bias?  The halflife I can
> guess at, but I'm not sure what scale of weight is sensible.

Something comparable to the weights which the terms get I'd expect.  I
didn't get as far as tuning the values to use.  It's possible there's
something of a catch 22 here where you really need to run the query to
know what weight makes sense.  Perhaps you should actual specify a value
which is scaled by the maximum weight a document could get, or something
like that.  Feedback from trying to use this would be very useful.

> 4. I've tried enquire_set_sorting from Perl and PHP and it doesn't seem
> to do anything.  I've set values in the documents, and can use those
> values with clustering no problem.  They just can't seem to be used to
> influence sorting.  Any suggestions?  I can provide more info.

There are tests for set_sorting so it looks like it works in C++.  Can
you post a simple example?


More information about the Xapian-discuss mailing list