<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Xapian: API Documentation: xapian-core: Xapian::BM25Weight Class Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.5.9 --> <script type="text/javascript"> <!-- function changeDisplayState (e){ var num=this.id.replace(/[^[0-9]/g,''); var button=this.firstChild; var sectionDiv=document.getElementById('dynsection'+num); if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){ sectionDiv.style.display='block'; button.src='open.gif'; }else{ sectionDiv.style.display='none'; button.src='closed.gif'; } } function initDynSections(){ var divs=document.getElementsByTagName('div'); var sectionCounter=1; for(var i=0;i<divs.length-1;i++){ if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){ var header=divs[i]; var section=divs[i+1]; var button=header.firstChild; if (button!='IMG'){ divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild); button=document.createElement('img'); divs[i].insertBefore(button,divs[i].firstChild); } header.style.cursor='pointer'; header.onclick=changeDisplayState; header.id='dynheader'+sectionCounter; button.src='closed.gif'; section.id='dynsection'+sectionCounter; section.style.display='none'; section.style.marginLeft='14px'; sectionCounter++; } } } window.onload = initDynSections; --> </script> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="classes.html"><span>Class Index</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="namespaceXapian.html">Xapian</a>::<a class="el" href="classXapian_1_1BM25Weight.html">BM25Weight</a> </div> </div> <div class="contents"> <h1>Xapian::BM25Weight Class Reference</h1><!-- doxytag: class="Xapian::BM25Weight" --><!-- doxytag: inherits="Xapian::Weight" --><a class="el" href="classXapian_1_1Weight.html" title="Abstract base class for weighting schemes.">Xapian::Weight</a> subclass implementing the BM25 probabilistic formula. <a href="#_details">More...</a> <p> <div class="dynheader"> Inheritance diagram for Xapian::BM25Weight:</div> <div class="dynsection"> <p><center><img src="classXapian_1_1BM25Weight__inherit__graph.png" border="0" usemap="#Xapian_1_1BM25Weight__inherit__map" alt="Inheritance graph"></center> <map name="Xapian_1_1BM25Weight__inherit__map"> <area shape="rect" href="classXapian_1_1Weight.html" title="Abstract base class for weighting schemes." alt="" coords="23,7,137,33"></map> <center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div> <p> <a href="classXapian_1_1BM25Weight-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1BM25Weight.html#40ccbf44b5aabe58c1258eb4abcd4df1">BM25Weight</a> (double k1, double k2, double k3, double b, double min_normlen)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Construct a <a class="el" href="classXapian_1_1BM25Weight.html" title="Xapian::Weight subclass implementing the BM25 probabilistic formula.">BM25Weight</a>. <a href="#40ccbf44b5aabe58c1258eb4abcd4df1"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1BM25Weight.html#943fdc83495a97f7d6af1208f5b26052">name</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return the name of this weighting scheme. <a href="#943fdc83495a97f7d6af1208f5b26052"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1BM25Weight.html#2dd2eb60deb5690e471d68f4c7fc3203">serialise</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return this object's parameters serialised as a single string. <a href="#2dd2eb60deb5690e471d68f4c7fc3203"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classXapian_1_1BM25Weight.html">BM25Weight</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1BM25Weight.html#8a9f0c48f4229aa0d62feff5f496dc78">unserialise</a> (const std::string &s) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Unserialise parameters. <a href="#8a9f0c48f4229aa0d62feff5f496dc78"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceXapian.html#cac12803afc9e24ee5141c119acb8884">Xapian::weight</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1BM25Weight.html#4fe48617e7db67232208a00b94878f54">get_sumpart</a> (<a class="el" href="namespaceXapian.html#72b5a76dd8cfb7b251fe7986e86390cb">Xapian::termcount</a> wdf, <a class="el" href="namespaceXapian.html#72b5a76dd8cfb7b251fe7986e86390cb">Xapian::termcount</a> doclen) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Calculate the weight contribution for this object's term to a document. <a href="#4fe48617e7db67232208a00b94878f54"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceXapian.html#cac12803afc9e24ee5141c119acb8884">Xapian::weight</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1BM25Weight.html#f23907adc06e73cdf1228fc616a2fda2">get_maxpart</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return an upper bound on what <a class="el" href="classXapian_1_1BM25Weight.html#4fe48617e7db67232208a00b94878f54" title="Calculate the weight contribution for this object's term to a document.">get_sumpart()</a> can return for any document. <a href="#f23907adc06e73cdf1228fc616a2fda2"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceXapian.html#cac12803afc9e24ee5141c119acb8884">Xapian::weight</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1BM25Weight.html#6992ef2cd23a095d607b70aa2076850b">get_sumextra</a> (<a class="el" href="namespaceXapian.html#72b5a76dd8cfb7b251fe7986e86390cb">Xapian::termcount</a> doclen) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Calculate the term-independent weight component for a document. <a href="#6992ef2cd23a095d607b70aa2076850b"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceXapian.html#cac12803afc9e24ee5141c119acb8884">Xapian::weight</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1BM25Weight.html#7c91481891313e089eb38bf1a9a83029">get_maxextra</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return an upper bound on what <a class="el" href="classXapian_1_1BM25Weight.html#6992ef2cd23a095d607b70aa2076850b" title="Calculate the term-independent weight component for a document.">get_sumextra()</a> can return for any document. <a href="#7c91481891313e089eb38bf1a9a83029"></a><br></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> <a class="el" href="classXapian_1_1Weight.html" title="Abstract base class for weighting schemes.">Xapian::Weight</a> subclass implementing the BM25 probabilistic formula. <hr><h2>Constructor & Destructor Documentation</h2> <a class="anchor" name="40ccbf44b5aabe58c1258eb4abcd4df1"></a><!-- doxytag: member="Xapian::BM25Weight::BM25Weight" ref="40ccbf44b5aabe58c1258eb4abcd4df1" args="(double k1, double k2, double k3, double b, double min_normlen)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">Xapian::BM25Weight::BM25Weight </td> <td>(</td> <td class="paramtype">double </td> <td class="paramname"> <em>k1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"> <em>k2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"> <em>k3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"> <em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"> <em>min_normlen</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Construct a <a class="el" href="classXapian_1_1BM25Weight.html" title="Xapian::Weight subclass implementing the BM25 probabilistic formula.">BM25Weight</a>. <p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>k1</em> </td><td>A non-negative parameter controlling how influential within-document-frequency (wdf) is. k1=0 means that wdf doesn't affect the weights. The larger k1 is, the more wdf influences the weights. (default 1)</td></tr> <tr><td valign="top"></td><td valign="top"><em>k2</em> </td><td>A non-negative parameter which controls the strength of a correction factor which depends upon query length and normalised document length. k2=0 disable this factor; larger k2 makes it stronger. (default 0)</td></tr> <tr><td valign="top"></td><td valign="top"><em>k3</em> </td><td>A non-negative parameter controlling how influential within-query-frequency (wqf) is. k3=0 means that wqf doesn't affect the weights. The larger k3 is, the more wqf influences the weights. (default 1)</td></tr> <tr><td valign="top"></td><td valign="top"><em>b</em> </td><td>A parameter between 0 and 1, controlling how strong the document length normalisation of wdf is. 0 means no normalisation; 1 means full normalisation. (default 0.5)</td></tr> <tr><td valign="top"></td><td valign="top"><em>min_normlen</em> </td><td>A parameter specifying a minimum value for normalised document length. Normalised document length values less than this will be clamped to this value, helping to prevent very short documents getting large weights. (default 0.5) </td></tr> </table> </dl> </div> </div><p> <hr><h2>Member Function Documentation</h2> <a class="anchor" name="7c91481891313e089eb38bf1a9a83029"></a><!-- doxytag: member="Xapian::BM25Weight::get_maxextra" ref="7c91481891313e089eb38bf1a9a83029" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="namespaceXapian.html#cac12803afc9e24ee5141c119acb8884">Xapian::weight</a> Xapian::BM25Weight::get_maxextra </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Return an upper bound on what <a class="el" href="classXapian_1_1BM25Weight.html#6992ef2cd23a095d607b70aa2076850b" title="Calculate the term-independent weight component for a document.">get_sumextra()</a> can return for any document. <p> This information is used by the matcher to perform various optimisations, so strive to make the bound as tight as possible. <p>Implements <a class="el" href="classXapian_1_1Weight.html#ca641ecc2f5645666820f864d243f46d">Xapian::Weight</a>.</p> </div> </div><p> <a class="anchor" name="f23907adc06e73cdf1228fc616a2fda2"></a><!-- doxytag: member="Xapian::BM25Weight::get_maxpart" ref="f23907adc06e73cdf1228fc616a2fda2" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="namespaceXapian.html#cac12803afc9e24ee5141c119acb8884">Xapian::weight</a> Xapian::BM25Weight::get_maxpart </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Return an upper bound on what <a class="el" href="classXapian_1_1BM25Weight.html#4fe48617e7db67232208a00b94878f54" title="Calculate the weight contribution for this object's term to a document.">get_sumpart()</a> can return for any document. <p> This information is used by the matcher to perform various optimisations, so strive to make the bound as tight as possible. <p>Implements <a class="el" href="classXapian_1_1Weight.html#f37e797fa12bb915f73b20b953a132b7">Xapian::Weight</a>.</p> </div> </div><p> <a class="anchor" name="6992ef2cd23a095d607b70aa2076850b"></a><!-- doxytag: member="Xapian::BM25Weight::get_sumextra" ref="6992ef2cd23a095d607b70aa2076850b" args="(Xapian::termcount doclen) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="namespaceXapian.html#cac12803afc9e24ee5141c119acb8884">Xapian::weight</a> Xapian::BM25Weight::get_sumextra </td> <td>(</td> <td class="paramtype"><a class="el" href="namespaceXapian.html#72b5a76dd8cfb7b251fe7986e86390cb">Xapian::termcount</a> </td> <td class="paramname"> <em>doclen</em> </td> <td> ) </td> <td> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Calculate the term-independent weight component for a document. <p> The parameter gives information about the document which may be used in the calculations:<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>doclen</em> </td><td>The document's length (unnormalised). </td></tr> </table> </dl> <p>Implements <a class="el" href="classXapian_1_1Weight.html#8c29b15b875e5666ac8b94c9a39e962f">Xapian::Weight</a>.</p> </div> </div><p> <a class="anchor" name="4fe48617e7db67232208a00b94878f54"></a><!-- doxytag: member="Xapian::BM25Weight::get_sumpart" ref="4fe48617e7db67232208a00b94878f54" args="(Xapian::termcount wdf, Xapian::termcount doclen) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="namespaceXapian.html#cac12803afc9e24ee5141c119acb8884">Xapian::weight</a> Xapian::BM25Weight::get_sumpart </td> <td>(</td> <td class="paramtype"><a class="el" href="namespaceXapian.html#72b5a76dd8cfb7b251fe7986e86390cb">Xapian::termcount</a> </td> <td class="paramname"> <em>wdf</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="namespaceXapian.html#72b5a76dd8cfb7b251fe7986e86390cb">Xapian::termcount</a> </td> <td class="paramname"> <em>doclen</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Calculate the weight contribution for this object's term to a document. <p> The parameters give information about the document which may be used in the calculations:<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>wdf</em> </td><td>The within document frequency of the term in the document. </td></tr> <tr><td valign="top"></td><td valign="top"><em>doclen</em> </td><td>The document's length (unnormalised). </td></tr> </table> </dl> <p>Implements <a class="el" href="classXapian_1_1Weight.html#8c6beb18e2c08cbc2ae61ec9d808ed9e">Xapian::Weight</a>.</p> </div> </div><p> <a class="anchor" name="943fdc83495a97f7d6af1208f5b26052"></a><!-- doxytag: member="Xapian::BM25Weight::name" ref="943fdc83495a97f7d6af1208f5b26052" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">std::string Xapian::BM25Weight::name </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Return the name of this weighting scheme. <p> This name is used by the remote backend. It is passed along with the serialised parameters to the remote server so that it knows which class to create.<p> Return the full namespace-qualified name of your class here - if your class is called FooWeight, return "FooWeight" from this method (<a class="el" href="classXapian_1_1BM25Weight.html" title="Xapian::Weight subclass implementing the BM25 probabilistic formula.">Xapian::BM25Weight</a> returns "Xapian::BM25Weight" here).<p> If you don't want to support the remote backend, you can use the default implementation which simply returns an empty string. <p>Reimplemented from <a class="el" href="classXapian_1_1Weight.html#afd3b445fb1955aae3d7c32aae3ba7b4">Xapian::Weight</a>.</p> </div> </div><p> <a class="anchor" name="2dd2eb60deb5690e471d68f4c7fc3203"></a><!-- doxytag: member="Xapian::BM25Weight::serialise" ref="2dd2eb60deb5690e471d68f4c7fc3203" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">std::string Xapian::BM25Weight::serialise </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Return this object's parameters serialised as a single string. <p> If you don't want to support the remote backend, you can use the default implementation which simply throws <a class="el" href="classXapian_1_1UnimplementedError.html" title="UnimplementedError indicates an attempt to use an unimplemented feature.">Xapian::UnimplementedError</a>. <p>Reimplemented from <a class="el" href="classXapian_1_1Weight.html#cf568da52a87e6a6786400dbd0a79edf">Xapian::Weight</a>.</p> </div> </div><p> <a class="anchor" name="8a9f0c48f4229aa0d62feff5f496dc78"></a><!-- doxytag: member="Xapian::BM25Weight::unserialise" ref="8a9f0c48f4229aa0d62feff5f496dc78" args="(const std::string &s) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classXapian_1_1BM25Weight.html">BM25Weight</a>* Xapian::BM25Weight::unserialise </td> <td>(</td> <td class="paramtype">const std::string & </td> <td class="paramname"> <em>s</em> </td> <td> ) </td> <td> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Unserialise parameters. <p> This method unserialises parameters serialised by the <em><a class="el" href="classXapian_1_1BM25Weight.html#2dd2eb60deb5690e471d68f4c7fc3203" title="Return this object's parameters serialised as a single string.">serialise()</a></em> method and allocates and returns a new object initialised with them.<p> If you don't want to support the remote backend, you can use the default implementation which simply throws <a class="el" href="classXapian_1_1UnimplementedError.html" title="UnimplementedError indicates an attempt to use an unimplemented feature.">Xapian::UnimplementedError</a>.<p> Note that the returned object will be deallocated by <a class="el" href="namespaceXapian.html" title="The Xapian namespace contains public interfaces for the Xapian library.">Xapian</a> after use with "delete". If you want to handle the deletion in a special way (for example when wrapping the <a class="el" href="namespaceXapian.html" title="The Xapian namespace contains public interfaces for the Xapian library.">Xapian</a> API for use from another language) then you can define a static <code>operator delete</code> method in your subclass as shown here: <a href="http://trac.xapian.org/ticket/554#comment:1">http://trac.xapian.org/ticket/554#comment:1</a><p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>s</em> </td><td>A string containing the serialised parameters. </td></tr> </table> </dl> <p>Reimplemented from <a class="el" href="classXapian_1_1Weight.html#031c3e0db3ae50e801b324e71a44c140">Xapian::Weight</a>.</p> </div> </div><p> <hr>The documentation for this class was generated from the following file:<ul> <li>xapian/<a class="el" href="weight_8h.html">weight.h</a></ul> </div> <hr> <address><small> Documentation for Xapian (version 1.2.12).<br> Generated on 27 Jun 2012 by <a href="http://www.doxygen.org/">Doxygen 1.5.9</a>. </small></address> </body> </html>