[KinoSearch] boosting doc score based on integer data
Marvin Humphrey
marvin at rectangular.com
Sat Dec 20 15:23:56 PST 2008
Dermot:
> I have a integer field (sales), it's the number of sales a doc has
> had. I don't want to sort the hits by this field so sort_spec is not
> the solution. I would like to use the integer value to moderate the
> final results. In effect, if a doc has 0 sales, it would get a boost
> of 0.8 and those docs with 5+ would get a 1.2 boost.
I suggest setting a document boost at index time, with the value determined by
your "sales" field:
my $doc = KinoSearch::Doc->new(
fields => \%fields,
boost => calc_boost( $fields{sales} )
);
> I have stored and indexed the field and it isn't being analyzed. I'm
> not clear on how to proceed after that. Do I need to create a custom
> Compiler/Query/Scorer?
I can envision a design which would allow you to affect scores using a custom
function fed by the integer value for each document. The advantage would be
that you could tweak at search-time rather than having to re-index.
However, this would have to wait for KS to add an integer field type, and, if
scaling to large size is important, a C API.
> A little guidance would be much appreciated. There are a lot of docs
> under KS::Search but I am not sure how to mould a custom
> Query-to-Scorer compiler or if that is the best path for me to take.
There's a Cookbook document on the subject of creating custom Query
subclasses:
http://xrl.us/o3z43 (Link to www.rectangular.com)
However, I recommend that you go with document boosts instead.
Marvin Humphrey
More information about the kinosearch
mailing list