[Xapian-discuss] Document weighting in 1.1

double ninive at gmx.at
Fri Sep 11 10:55:11 BST 2009


Richard Boulton schrieb:
> Firstly, at index time, you need to put a weight into the slot. We'll use
> slot number 0, but any other slot could be used.  We need to convert the
> weight to a string representation, and xapian provides a function to do
> this: sortable_serialise:
>   

Hi Richard,

The document weights are very cool!

Just a quick note.
It works only with slot number 0, but it doesn't work
so far with any other slot. I only added these lines
to my code:

xapian_document.add_value( 0, Xapian::sortable_serialise(weight) );

And right before Xapian::Enquire():

Xapian::ValueWeightPostingSource xapian_valueweight( 0 );
xapian_query = Xapian::Query( Xapian::Query::OP_AND_MAYBE,
                 xapian_query, Xapian::Query(&xapian_valueweight) );

Thanks
Marcus






More information about the Xapian-discuss mailing list