00001 00004 /* Copyright (C) 2007,2008,2009 Olly Betts 00005 * Copyright (C) 2009 Lemur Consulting Ltd 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License as 00009 * published by the Free Software Foundation; either version 2 of the 00010 * License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00022 #ifndef XAPIAN_INCLUDED_POSTLIST_H 00023 #define XAPIAN_INCLUDED_POSTLIST_H 00024 00025 #include <string> 00026 00027 #include <xapian/base.h> 00028 #include <xapian/types.h> 00029 #include <xapian/postingiterator.h> 00030 00031 #include "positionlist.h" 00032 #include "weightinternal.h" 00033 00035 class Xapian::PostingIterator::Internal : public Xapian::Internal::RefCntBase { 00037 void operator=(const Internal &); 00038 00040 Internal(const Internal &); 00041 00042 protected: 00044 Internal() { } 00045 00046 public: 00050 virtual ~Internal(); 00051 00053 virtual Xapian::doccount get_termfreq_min() const = 0; 00054 00056 virtual Xapian::doccount get_termfreq_max() const = 0; 00057 00063 virtual Xapian::doccount get_termfreq_est() const = 0; 00064 00071 virtual TermFreqs get_termfreq_est_using_stats( 00072 const Xapian::Weight::Internal & stats) const; 00073 00075 virtual Xapian::weight get_maxweight() const = 0; 00076 00078 virtual Xapian::docid get_docid() const = 0; 00079 00081 virtual Xapian::termcount get_doclength() const = 0; 00082 /* FIXME: Once flint has been retired, we should probably strip out 00083 * PostList::get_doclength() and just fetch it from the DB directly. 00084 */ 00085 00090 virtual Xapian::termcount get_wdf() const; 00091 00093 virtual Xapian::weight get_weight() const = 0; 00094 00101 virtual const std::string * get_collapse_key() const; 00102 00104 virtual bool at_end() const = 0; 00105 00114 virtual Xapian::weight recalc_maxweight() = 0; 00115 00121 virtual PositionList * read_position_list(); 00122 00128 virtual PositionList * open_position_list() const; 00129 00144 virtual Internal * next(Xapian::weight w_min) = 0; 00145 00159 virtual Internal * skip_to(Xapian::docid, Xapian::weight w_min) = 0; 00160 00180 virtual Internal * check(Xapian::docid did, Xapian::weight w_min, 00181 bool &valid); 00182 00187 Internal * next() { return next(0.0); } 00188 00193 Internal * skip_to(Xapian::docid did) { return skip_to(did, 0.0); } 00194 00196 virtual Xapian::termcount count_matching_subqs() const; 00197 00199 virtual std::string get_description() const = 0; 00200 }; 00201 00202 // In the external API headers, this class is Xapian::PostingIterator::Internal, 00203 // but in the library code it's still known as "PostList" in most places. 00204 typedef Xapian::PostingIterator::Internal PostList; 00205 00206 #endif // XAPIAN_INCLUDED_POSTLIST_H