[Xapian-discuss] Sorting set_sort_by_relevance_then_value

Andrey Kong alpha04 at netvigator.com
Sat Dec 9 04:27:46 GMT 2006


Thx for the reply

now i understand why the sorting seems doesnt work after relevance. Since I 
already changed the relevance to (%),
therefore I see some with Same relevance (same %) but sorting is wrong.
Actually they are with different relevance values(non %) behind the scene.

Thank you
Andrey K.

----- Original Message ----- 
From: "Olly Betts" <olly at survex.com>
To: "Andrey Kong" <alpha04 at netvigator.com>
Cc: <xapian-discuss at lists.xapian.org>
Sent: Saturday, December 09, 2006 12:03 PM
Subject: Re: [Xapian-discuss] Sorting set_sort_by_relevance_then_value


> On Sat, Dec 09, 2006 at 10:45:53AM +0800, Andrey Kong wrote:
>> I want to set_sort_by_relevance_then_value(0), but seems it doesnt work 
>> (PHP)
>>
>> $db = new XapianWritableDatabase("fullIndex3", DB_OPEN);
>> $op_or = XapianQuery::OP_OR;
>> $terms = array("google" ,"yahoo");
>> $enq = new XapianEnquire($db);
>>
>> $query=new XapianQuery($op_or, $terms);
>> $enq->set_sort_by_relevance_then_value(0);
>> $enq->set_query($query);
>
> The documentation for Enquire::set_sort_by_relevance_then_value() says:
>
>     Note that with the default BM25 weighting scheme parameters,
>     non-identical documents will rarely have the same weight, so this
>     setting will give very similar results to set_sort_by_relevance().
>     It becomes more useful with particular BM25 parameter settings
>     (e.g. BM25Weight(1,0,1,0,0)) or custom weighting schemes.
>
> Your example uses the default BM25 parameters, so this applies to you.
> Try printing out the *differences* between the weights of adjacent
> documents in the MSet (just printing out the weights will probably
> show them as the same, but that's just because you aren't seeing
> all the significant figures).
>
> The default BM25 parameters which Xapian uses include the normalised
> document length in calculations.  Documents are usually different
> lengths so it's rare for two documents to get the exact same weight.
>
>> i also tried to replace with set_docid_order() , still dosnt work too..
>
> The same thing applies.
>
> Cheers,
>    Olly 




More information about the Xapian-discuss mailing list