api/leafpostlist.cc

Go to the documentation of this file.
00001 
00004 /* Copyright (C) 2007 Olly Betts
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License as
00008  * published by the Free Software Foundation; either version 2 of the
00009  * License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00019  */
00020 
00021 #include <config.h>
00022 
00023 #include <xapian/enquire.h> // For Xapian::Weight.
00024 
00025 #include "leafpostlist.h"
00026 #include "omassert.h"
00027 
00028 LeafPostList::~LeafPostList()
00029 {
00030     delete weight;
00031 }
00032 
00033 Xapian::doccount
00034 LeafPostList::get_termfreq_min() const
00035 {
00036     return get_termfreq();
00037 }
00038 
00039 Xapian::doccount
00040 LeafPostList::get_termfreq_max() const
00041 {
00042     return get_termfreq();
00043 }
00044 
00045 Xapian::doccount
00046 LeafPostList::get_termfreq_est() const
00047 {
00048     return get_termfreq();
00049 }
00050 
00051 void
00052 LeafPostList::set_termweight(const Xapian::Weight * weight_)
00053 {
00054     // This method shouldn't be called more than once on the same object.
00055     Assert(!weight);
00056     weight = weight_;
00057     need_doclength = weight->get_sumpart_needs_doclength();
00058 }
00059 
00060 Xapian::weight
00061 LeafPostList::get_maxweight() const
00062 {
00063     return weight ? weight->get_maxpart() : 0;
00064 }
00065 
00066 Xapian::weight
00067 LeafPostList::get_weight() const
00068 {
00069     if (!weight) return 0;
00070     Xapian::doclength doclen = 0;
00071     // Fetching the document length is work we can avoid if the weighting
00072     // scheme doesn't use it.
00073     if (need_doclength) doclen = get_doclength();
00074     return weight->get_sumpart(get_wdf(), doclen);
00075 }
00076 
00077 Xapian::weight
00078 LeafPostList::recalc_maxweight()
00079 {
00080     return LeafPostList::get_maxweight();
00081 }

Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.