Hi guys, I resently used xapian to sort some documents by distance between 2 points. I implemented a MatchDecider which work well. I now tried to implement a Weight scheme to put my document in ascending order depending on the distance... My information to calcul distance is in values in the document. How I can access document values from Weight to be able to add some sum_extra weight ?? I just tried to create a function in Weight that look like: Xapian::weight get_sumextra(std::map<Xapian::valueno, std::string> values) const; to calculate an extra weight from my documents values... But now I going deeper and deeper in the code to make this functions working... Is it the good way to do this or there is an easier way ?? Thanks a lot Regards. Eric
Hi Eric Can you please post your MatchDecider function here, I'm trying to implement one myself but am a little lost on how to get it working. Thanks Alec Eric Langevin wrote:> Hi guys, > I resently used xapian to sort some documents by distance between 2 > points. > I implemented a MatchDecider which work well. > > I now tried to implement a Weight scheme to put my document in > ascending order depending on the distance... > My information to calcul distance is in values in the document. > > How I can access document values from Weight to be able to add some > sum_extra weight ?? > > I just tried to create a function in Weight that look like: > Xapian::weight get_sumextra(std::map<Xapian::valueno, std::string> > values) const; > to calculate an extra weight from my documents values... > > But now I going deeper and deeper in the code to make this functions > working... > Is it the good way to do this or there is an easier way ?? > > Thanks a lot > > Regards. > > Eric > > > _______________________________________________ > Xapian-devel mailing list > Xapian-devel at lists.xapian.org > http://lists.xapian.org/mailman/listinfo/xapian-devel >
On Tue, Jul 25, 2006 at 11:54:15AM -0400, Eric Langevin wrote:> Is it the good way to do this or there is an easier way ??It sounds like you're really wanting the not-yet-really-implemented MatchBiasFunctor. This would allow an arbitrary extra weight to be given for each document, so using BoolWeight() with a suitable MatchBiasFunctor would allow you to rank purely by distance. Unfortunately the current MatchBiasFunctor is a proof-of-concept hard-wired to a particular use. Rusty Conover was working on an ExternalPostList which would provide most of the infrastructure for this, but I don't think I've seen anything since his initial patch. Gmane's threaded view seems to be broken right now, but you can see the thread via the search: http://search.gmane.org/?query=externalpostlist&group=&sort=revdate It's something I'd like to see, but I'm not likely to find time to work on it myself for a while. Cheers, Olly