00001 00004 /* Copyright (C) 2007,2008,2009 Olly Betts 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (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 #ifndef XAPIAN_INCLUDED_CHERT_TERMLISTTABLE_H 00022 #define XAPIAN_INCLUDED_CHERT_TERMLISTTABLE_H 00023 00024 #include <xapian/types.h> 00025 00026 #include "chert_lazytable.h" 00027 #include "pack.h" 00028 00029 #include <string> 00030 00031 namespace Xapian { 00032 class Document; 00033 } 00034 00035 class ChertTermListTable : public ChertLazyTable { 00036 public: 00037 static std::string make_key(Xapian::docid did) { 00038 std::string key; 00039 pack_uint_preserving_sort(key, did); 00040 return key; 00041 } 00042 00051 ChertTermListTable(const std::string & dbdir, bool readonly) 00052 : ChertLazyTable("termlist", dbdir + "/termlist.", readonly, 00053 Z_DEFAULT_STRATEGY) { } 00054 00063 void set_termlist(Xapian::docid did, const Xapian::Document & doc, 00064 chert_doclen_t doclen); 00065 00070 void delete_termlist(Xapian::docid did) { del(make_key(did)); } 00071 00079 void create_and_open(unsigned int blocksize) { 00080 ChertTable::create_and_open(blocksize); 00081 } 00082 }; 00083 00084 #endif // XAPIAN_INCLUDED_CHERT_TERMLISTTABLE_H