00001 /* multi_postlist.h: C++ class definition for multiple database access 00002 * 00003 * Copyright 1999,2000,2001 BrightStation PLC 00004 * Copyright 2003,2005,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 00019 * USA 00020 */ 00021 00022 #ifndef OM_HGUARD_MULTI_POSTLIST_H 00023 #define OM_HGUARD_MULTI_POSTLIST_H 00024 00025 #include "leafpostlist.h" 00026 #include <vector> 00027 00028 class MultiPostList : public LeafPostList { 00029 friend class Xapian::Database; 00030 private: 00031 std::vector<LeafPostList *> postlists; 00032 00033 const Xapian::Database &this_db; 00034 00035 bool finished; 00036 Xapian::docid currdoc; 00037 00038 mutable bool freq_initialised; 00039 mutable Xapian::doccount termfreq; 00040 00041 Xapian::doccount multiplier; 00042 00043 MultiPostList(std::vector<LeafPostList *> & pls, 00044 const Xapian::Database &this_db_); 00045 public: 00046 ~MultiPostList(); 00047 00048 Xapian::doccount get_termfreq() const; 00049 00050 Xapian::docid get_docid() const; // Gets current docid 00051 Xapian::doclength get_doclength() const; // Get length of current document 00052 Xapian::termcount get_wdf() const; // Within Document Frequency 00053 PositionList *read_position_list(); 00054 PositionList * open_position_list() const; 00055 PostList *next(Xapian::weight w_min); // Moves to next docid 00056 PostList *skip_to(Xapian::docid did, Xapian::weight w_min);// Moves to next docid >= specified docid 00057 bool at_end() const; // True if we're off the end of the list 00058 00059 std::string get_description() const; 00060 }; 00061 00062 #endif /* OM_HGUARD_MULTI_POSTLIST_H */