Hi! I'm evaluating using xapian for indexing an ecommerce site, instead of using a rdbms as we currently do. 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. Is there any way to do this with xapian? I noticed that you can order by an arbitrary document sort key but what I really need is to combine this key with the relevance calculated by xapian weighting. Sorting first by qrel and then by brel or vice versa (*set_sort_by_value_then_relevance) *wouldn't work either. What about bias functors? Can you give me some clue on using them? Thank you in advance. Best regards, Carlos
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 -- /--------------------------------------------------------------------------\ James Aylett xapian.org james@tartarus.org uncertaintydivision.org
On Fri, Jan 20, 2006 at 07:00:27AM -0300, Carlos Pita wrote:> What about bias functors? Can you give me some clue on > using them?A bias functor is exactly what you're looking for. The implementation is currently incomplete. It's really just a prototype for the idea which I wrote while I was at Ananova, the idea being to give a relevance boost to more recent news articles, with the boost exponentially decaying for older articles. However, the management decided they wanted a different approach so it never got finished. What's needed is a class you derive from to specify the bias functor, rather like how Xapian::Weight and Xapian::MatchDecider work. It's been on my list of "things that really should be sorted out" for a while, so hopefully I should get to it soon. Cheers, Olly