[KinoSearch] Retrieving $doc->set_boost() value at search time

Marvin Humphrey marvin at rectangular.com
Mon Oct 30 10:41:28 PST 2006




On Oct 27, 2006, at 1:58 AM, henka at cityweb.co.za wrote:

> Given the following code which is used during index-time:
>
> $doc->set_boost($boost_val);
>
> Is there any way to retrieve this $boost_value value during search- 
> time
> for debugging purposes?

There is not.  The boost information is not stored along with the  
document.  It's factored into the calculation of each term's "norm",  
which ends up as custom 8-bit float with a 3 bit mantissa and a 5 bit  
exponent, for about 1 decimal digit of precision.  You can't get the  
document boost back, unless you store it as its own field.

> I tried:
>
> while ( my $hit = $hits->fetch_hit_hashref ) {
>   my $doc = $hit->get_doc;
>   my $boost = $doc->get_boost;
>   ...
>
> Which produces this error:
>
> "Can't call method "get_doc" on unblessed reference at..."

You get that error because you're using the convenience method $hits- 
 >fetch_hit_hashref, instead of $hits->fetch_hit.  However, even if  
you did get a real Doc object via a real Hit object, it wouldn't  
provide you with an accurate number for get_boost.

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/



_______________________________________________
KinoSearch mailing list
KinoSearch at rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch




More information about the kinosearch mailing list