Kenneth Loafman
2007-Jan-26 12:58 UTC
[Xapian-discuss] Finding Max Possible Weight of a Document
Is there a way, without running a match, to find the max possible weight of a document? This could be with or without consideration of the length of the document. I have looked at all of the docs available on the web and installed on the system and may just be overlooking it. The most direct way would be to sum the term weights times term freq of each document, but it would be nice if there was a call to do just that. ...Thanks, ...Ken
Olly Betts
2007-Feb-06 00:03 UTC
[Xapian-discuss] Finding Max Possible Weight of a Document
On Fri, Jan 26, 2007 at 06:57:37AM -0600, Kenneth Loafman wrote:> Is there a way, without running a match, to find the max possible weight > of a document? This could be with or without consideration of the > length of the document. I have looked at all of the docs available on > the web and installed on the system and may just be overlooking it.Are you trying to find the max possible weight of a particular document, or of any document in the database? If it's any document in the database, you can call Enquire::get_mset() with maxitems = 0 and get_max_possible() on the resulting MSet will give you an upper bound (in this case, no actual matching happens).> The most direct way would be to sum the term weights times term freq of > each document, but it would be nice if there was a call to do just that.The document weight isn't necessarily calculated by such a sum. There's a weight from each term, which typically is a function of the wdf (i.e. the frequency of the term in a particular document) but not necessarily in the form of a product. There's also an optional extra term in the sum (dependent on document length). Perhaps you could tell us what you're trying to achieve here? Cheers, Olly