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" 00024 #include "weightinternal.h" 00025 00026 namespace Xapian { 00027 00028 /* Xapian::Weight */ 00029 00030 // FIXME:1.1: delete internal here 00031 Weight::~Weight() { } 00032 00033 Weight * 00034 Weight::create(const Internal * internal_, Xapian::doclength querysize_, 00035 Xapian::termcount wqf_, const std::string & tname_) const 00036 { 00037 // FIXME:1.1: put internal_ into an AutoPtr here, so that it won't get 00038 // leaked if an exception occurs in clone(). 00039 Weight * new_weight = clone(); 00040 new_weight->internal = internal_; 00041 new_weight->querysize = querysize_; 00042 new_weight->wqf = wqf_; 00043 new_weight->tname = tname_; 00044 return new_weight; 00045 } 00046 00047 bool Weight::get_sumpart_needs_doclength() const { return true; } 00048 00049 /* Xapian::BoolWeight */ 00050 00051 BoolWeight * BoolWeight::clone() const { return new BoolWeight; } 00052 00053 BoolWeight::~BoolWeight() { } 00054 00055 std::string BoolWeight::name() const { return "Bool"; } 00056 00057 std::string BoolWeight::serialise() const { return ""; } 00058 00059 BoolWeight * 00060 BoolWeight::unserialise(const std::string &) const 00061 { 00062 return new BoolWeight; 00063 } 00064 00065 Xapian::weight 00066 BoolWeight::get_sumpart(Xapian::termcount, Xapian::doclength) const 00067 { 00068 return 0; 00069 } 00070 00071 Xapian::weight BoolWeight::get_maxpart() const { return 0; } 00072 00073 Xapian::weight BoolWeight::get_sumextra(Xapian::doclength) const { return 0; } 00074 00075 Xapian::weight BoolWeight::get_maxextra() const { return 0; } 00076 00077 bool BoolWeight::get_sumpart_needs_doclength() const { return false; } 00078 00079 }