xapian-core  1.4.21
glass_termlisttable.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2007,2008,2009,2010,2013,2014,2015,2016 Olly Betts
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef XAPIAN_INCLUDED_GLASS_TERMLISTTABLE_H
22 #define XAPIAN_INCLUDED_GLASS_TERMLISTTABLE_H
23 
24 #include <xapian/constants.h>
25 #include <xapian/types.h>
26 
27 #include "glass_table.h"
28 #include "pack.h"
29 
30 #include <string>
31 
32 namespace Xapian {
33 class Document;
34 }
35 
37  public:
38  static std::string make_key(Xapian::docid did) {
39  std::string key;
40  pack_uint_preserving_sort(key, did);
41  return key;
42  }
43 
53  GlassTermListTable(const std::string & dbdir, bool readonly, bool lazy_)
54  : GlassTable("termlist", dbdir + "/termlist.", readonly, lazy_) { }
55 
56  GlassTermListTable(int fd, off_t offset_, bool readonly, bool lazy_)
57  : GlassTable("termlist", fd, offset_, readonly, lazy_) { }
58 
67  void set_termlist(Xapian::docid did, const Xapian::Document & doc,
68  Xapian::termcount doclen);
69 
74  void delete_termlist(Xapian::docid did) { del(make_key(did)); }
75 };
76 
77 #endif // XAPIAN_INCLUDED_GLASS_TERMLISTTABLE_H
The Xapian namespace contains public interfaces for the Xapian library.
Definition: compactor.cc:80
void delete_termlist(Xapian::docid did)
Delete the termlist data for document did.
typedefs for Xapian
Class managing a Btree table in a Glass database.
Definition: glass_table.h:430
Constants in the Xapian namespace.
GlassTermListTable(int fd, off_t offset_, bool readonly, bool lazy_)
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Definition: types.h:72
static std::string make_key(Xapian::docid did)
Btree implementation.
Pack types into strings and unpack them again.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Definition: types.h:52
A handle representing a document in a Xapian database.
Definition: document.h:61
string make_key(Xapian::docid did)
Definition: chert_record.cc:35
GlassTermListTable(const std::string &dbdir, bool readonly, bool lazy_)
Create a new GlassTermListTable object.
void pack_uint_preserving_sort(std::string &s, U value)
Append an encoded unsigned integer to a string, preserving the sort order.
Definition: pack.h:269