00001 /* emptypostlist.h: empty posting list (for zero frequency terms) 00002 * 00003 * Copyright 1999,2000,2001 BrightStation PLC 00004 * Copyright 2002,2003,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_EMPTYPOSTLIST_H 00023 #define OM_HGUARD_EMPTYPOSTLIST_H 00024 00025 #include "leafpostlist.h" 00026 #include "omassert.h" 00027 00028 class EmptyPostList : public LeafPostList { 00029 public: 00030 Xapian::doccount get_termfreq() const { return 0; } 00031 00032 Xapian::docid get_docid() const; 00033 Xapian::weight get_weight() const; 00034 Xapian::weight get_maxweight() const { return 0; } 00035 Xapian::doclength get_doclength() const; 00036 PositionList *read_position_list(); 00037 PositionList * open_position_list() const; 00038 00039 PostList *next(Xapian::weight w_min); 00040 PostList *skip_to(Xapian::docid did, Xapian::weight w_min); 00041 bool at_end() const; 00042 00043 string get_description() const; 00044 }; 00045 00046 inline Xapian::docid 00047 EmptyPostList::get_docid() const 00048 { 00049 Assert(0); // no documents 00050 return 0; 00051 } 00052 00053 inline Xapian::weight 00054 EmptyPostList::get_weight() const 00055 { 00056 Assert(0); // no documents 00057 return 0; 00058 } 00059 00060 inline Xapian::doclength 00061 EmptyPostList::get_doclength() const 00062 { 00063 Assert(0); // no documents 00064 return 0; 00065 } 00066 00067 inline PositionList * 00068 EmptyPostList::read_position_list() 00069 { 00070 Assert(0); // no positions 00071 return 0; 00072 } 00073 00074 inline PositionList * 00075 EmptyPostList::open_position_list() const 00076 { 00077 Assert(0); // no positions 00078 return 0; 00079 } 00080 00081 inline PostList * 00082 EmptyPostList::next(Xapian::weight /*w_min*/) 00083 { 00084 return 0; 00085 } 00086 00087 inline PostList * 00088 EmptyPostList::skip_to(Xapian::docid /*did*/, Xapian::weight /*w_min*/) 00089 { 00090 return 0; 00091 } 00092 00093 inline bool 00094 EmptyPostList::at_end() const 00095 { 00096 return true; 00097 } 00098 00099 inline string 00100 EmptyPostList::get_description() const 00101 { 00102 return "[empty]"; 00103 } 00104 00105 #endif /* OM_HGUARD_EMPTYPOSTLIST_H */