Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Xapian::BM25Weight Class Reference

BM25 weighting scheme. More...

#include <enquire.h>

Inheritance diagram for Xapian::BM25Weight:

Inheritance graph
[legend]
Collaboration diagram for Xapian::BM25Weight:

Collaboration graph
[legend]
List of all members.

Public Methods

 BM25Weight (double A_, double B_, double C_, double D_, double min_normlen_)
 Construct a BM25 weight. More...

 BM25Weight ()
Weightclone () const
 Return a new weight object of this type. More...

 ~BM25Weight ()
std::string name () const
 Name of the weighting scheme. More...

std::string serialise () const
 Serialise object parameters into a string. More...

Weightunserialise (const std::string &s) const
 Create object given string serialisation returned by serialise(). More...

Xapian::weight get_sumpart (Xapian::termcount wdf, Xapian::doclength len) const
 Get a weight which is part of the sum over terms being performed. More...

Xapian::weight get_maxpart () const
 Gets the maximum value that get_sumpart() may return. More...

Xapian::weight get_sumextra (Xapian::doclength len) const
 Get an extra weight for a document to add to the sum calculated over the query terms. More...

Xapian::weight get_maxextra () const
 Gets the maximum value that get_sumextra() may return. More...

bool get_sumpart_needs_doclength () const
 return false if the weight object doesn't need doclength. More...


Detailed Description

BM25 weighting scheme.

BM25 weighting options : The BM25 formula is

where


Constructor & Destructor Documentation

Xapian::BM25Weight::BM25Weight double    A_,
double    B_,
double    C_,
double    D_,
double    min_normlen_
[inline]
 

Construct a BM25 weight.

Parameters:
A  governs the importance of within query frequency. Must be >= 0. 0 means ignore wqf. Default is 1.
B  governs the importance of within document frequency. Must be >= 0. 0 means ignore wdf. Default is 1.
C  compensation factor for the high wdf values in large documents. Must be >= 0. 0 means no compensation. Default is 0.
D  Relative importance of within document frequency and document length. Must be >= 0 and <= 1. Default is 0.5.
min_normlen  specifies a cutoff on the minimum value that can be used for a normalised document length - smaller values will be forced up to this cutoff. This prevents very small documents getting a huge bonus weight. Default is 0.5.


Member Function Documentation

Weight* Xapian::BM25Weight::clone   const [inline, virtual]
 

Return a new weight object of this type.

Each subclass should implement this as: virtual OmFooWeight * clone() const { return new OmFooWeight(param1, param2); }

Implements Xapian::Weight.

Xapian::weight Xapian::BM25Weight::get_maxextra   const [virtual]
 

Gets the maximum value that get_sumextra() may return.

This is used in optimising searches.

Implements Xapian::Weight.

Xapian::weight Xapian::BM25Weight::get_maxpart   const [virtual]
 

Gets the maximum value that get_sumpart() may return.

This is used in optimising searches, by having the postlist tree decay appropriately when parts of it can have limited, or no, further effect.

Implements Xapian::Weight.

Xapian::weight Xapian::BM25Weight::get_sumextra Xapian::doclength    len const [virtual]
 

Get an extra weight for a document to add to the sum calculated over the query terms.

This returns a weight for a given document, and is used by some weighting schemes to account for influence such as document length.

Parameters:
len  the (unnormalised) document length.

Implements Xapian::Weight.

Xapian::weight Xapian::BM25Weight::get_sumpart Xapian::termcount    wdf,
Xapian::doclength    len
const [virtual]
 

Get a weight which is part of the sum over terms being performed.

This returns a weight for a given term and document. These weights are summed to give a total weight for the document.

Parameters:
wdf  the within document frequency of the term.
len  the (unnormalised) document length.

Implements Xapian::Weight.

bool Xapian::BM25Weight::get_sumpart_needs_doclength   const [inline, virtual]
 

return false if the weight object doesn't need doclength.

Reimplemented from Xapian::Weight.

std::string Xapian::BM25Weight::name   const [inline, virtual]
 

Name of the weighting scheme.

If the subclass is called FooWeight, this should return "Foo".

Implements Xapian::Weight.

std::string Xapian::BM25Weight::serialise   const [virtual]
 

Serialise object parameters into a string.

Implements Xapian::Weight.

Weight* Xapian::BM25Weight::unserialise const std::string &    s const [virtual]
 

Create object given string serialisation returned by serialise().

Implements Xapian::Weight.


The documentation for this class was generated from the following file:
Documentation for Xapian (version 0.8.1).
Generated on 30 Jun 2004 by Doxygen 1.2.15.