00001 /* net_termlist.h 00002 * 00003 * Copyright 1999,2000,2001 BrightStation PLC 00004 * Copyright 2003,2006,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_NET_TERMLIST_H 00023 #define OM_HGUARD_NET_TERMLIST_H 00024 00025 #include <string> 00026 00027 #include <xapian/types.h> 00028 #include <xapian/error.h> 00029 #include "termlist.h" 00030 #include "expandweight.h" 00031 #include "remote-database.h" 00032 00033 using namespace std; 00034 00037 class NetworkTermListItem { 00038 public: 00041 string tname; 00042 00047 Xapian::doccount termfreq; 00048 00054 Xapian::termcount wdf; 00055 }; 00056 00061 class NetworkTermList : public TermList { 00062 friend class RemoteDatabase; 00063 private: 00066 vector<NetworkTermListItem> items; 00067 00070 vector<NetworkTermListItem>::const_iterator current_position; 00071 00074 bool started; 00075 00080 Xapian::doclength document_length; 00081 00088 Xapian::doccount database_size; 00089 00091 Xapian::Internal::RefCntPtr<const RemoteDatabase> this_db; 00092 00094 Xapian::docid did; 00095 00104 NetworkTermList(Xapian::doclength document_length_, 00105 Xapian::doccount database_size_, 00106 Xapian::Internal::RefCntPtr<const RemoteDatabase> this_db_, 00107 Xapian::docid did_); 00108 public: 00109 00112 Xapian::termcount get_approx_size() const; 00113 00114 // Collate weighting information for the current term. 00115 void accumulate_stats(Xapian::Internal::ExpandStats &stats) const; 00116 string get_termname() const; 00117 Xapian::termcount get_wdf() const; 00118 Xapian::doccount get_termfreq() const; 00119 TermList * next(); 00120 bool at_end() const; 00121 00122 Xapian::termcount positionlist_count() const; 00123 Xapian::PositionIterator positionlist_begin() const; 00124 }; 00125 00126 #endif /* OM_HGUARD_NET_TERMLIST_H */