[Xapian-discuss] Sorting by a custom expr

Carlos Pita carlosjosepita at gmail.com
Fri Jan 20 11:00:43 GMT 2006


Umh, I can't see how to get a value from a document while
computing weight inside a subclass of Xapian::Weight. The
interface

Xapian::weight 
<http://www.xapian.org/docs/apidoc/html/types_8h.html#a10> get_sumpart 
<http://www.xapian.org/docs/apidoc/html/classXapian_1_1Weight.html#a6> 
(Xapian::termcount 
<http://www.xapian.org/docs/apidoc/html/types_8h.html#a3> wdf, 
Xapian::doclength 
<http://www.xapian.org/docs/apidoc/html/types_8h.html#a7> len)
Xapian::weight 
<http://www.xapian.org/docs/apidoc/html/types_8h.html#a10> get_sumextra 
<http://www.xapian.org/docs/apidoc/html/classXapian_1_1Weight.html#a8> 
(Xapian::doclength 
<http://www.xapian.org/docs/apidoc/html/types_8h.html#a7> len)

doesn't take the document as a parameter but just the
the document length. And the brel I need is a custom value
attached to the document. Am I missing something?

Best regards,
Carlos

James Aylett wrote:

>On Fri, Jan 20, 2006 at 07:00:27AM -0300, Carlos Pita wrote:
>
>  
>
>>I need to keep a fixed relevance number for each document which is
>>precalculated from "business variables" external to the query. Call
>>it brel and then call qrel the relevance coming from the query,
>>which would be calculated by xapian.  brel and qrel are combined in
>>an expression like (B * brel + Q * qrel), with B and Q constants, to
>>obtain the final relevance according to which the documents
>>(products) must be sorted.
>>    
>>
>
>You should be able to do this with a custom weighting class. This
>isn't supported in most of the bindings yet, but it'll work from C++.
>
>Cheers,
>James
>
>  
>




More information about the Xapian-discuss mailing list