[Xapian-devel] Custom weight factors - pushing the relevancyranking how we want it

Mikael Johansson medb at home.se
Mon Aug 1 12:14:39 BST 2005


Have done some work on implementing pagerank in xapian, the part missing is 
some way to assign a custom weight to a document. The data needed to 
calculate pagerank is held in an external database meaning that changes to 
xapian would be minimal; MatchBiasFunctor and something along the lines of 
this would probably do.

//Mikael

class ValueBiasFunctor : public MatchBiasFunctor {
 private:
  Xapian::Database _db;
  Xapian::valueno _valueno;
  Xapian::weight _max_weight;
  int _max_value;

 public:
  ValueBiasFunctor(const Xapian::Database &db, Xapian::valueno valueno) :
   _db(db), _valueno(valueno), _max_weight(15), _max_value(65535) {}

  ValueBiasFunctor(const Xapian::Database &db, Xapian::valueno valueno, 
Xapian::weight max_weight, int max_value) :
   _db(db), _valueno(valueno), _max_weight(max_weight), 
_max_value(max_value) {}

  Xapian::weight get_maxweight() {
   return _max_weight;
  }

  Xapian::weight get_weight(Xapian::docid id) {
   return _max_weight * (atoi(_db.get_document(id).get_value(_valueno)) / 
_max_value);
  }
}

----- Original Message ----- 
From: "Olly Betts" <olly at survex.com>
To: <xapian-devel at lists.xapian.org>
Sent: Friday, December 17, 2004 1:11 PM
Subject: Re: [Xapian-devel] Custom weight factors - pushing the 
relevancyranking how we want it


> On Fri, Dec 17, 2004 at 10:28:42AM +0000, James Aylett wrote:
>> There's currently no way of using document values (pieces of
>> information stored about the document) in the mix to calculate weights
>
> The match bias code allows this, or will once it's finished.
>

[snip]

Ref
http://comments.gmane.org/gmane.comp.search.xapian.devel/437
http://www.synd.info/ 




More information about the Xapian-devel mailing list