Branch data Line data Source code
1 : : /** @file flint_termlisttable.h
2 : : * @brief Subclass of FlintTable which holds termlists.
3 : : */
4 : : /* Copyright (C) 2007 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_FLINT_TERMLISTTABLE_H
22 : : #define XAPIAN_INCLUDED_FLINT_TERMLISTTABLE_H
23 : :
24 : : #include <xapian/types.h>
25 : :
26 : : #include "flint_table.h"
27 : : #include "flint_utils.h"
28 : :
29 : : #include <string>
30 : :
31 : : namespace Xapian {
32 : : class Document;
33 : : }
34 : :
35 : 2193 : class FlintTermListTable : public FlintTable {
36 : : public:
37 : : /** Create a new FlintTermListTable object.
38 : : *
39 : : * This method does not create or open the table on disk - you
40 : : * must call the create() or open() methods respectively!
41 : : *
42 : : * @param dbdir The directory the flint database is stored in.
43 : : * @param readonly true if we're opening read-only, else false.
44 : : */
45 : 2193 : FlintTermListTable(const std::string & dbdir, bool readonly)
46 : 2193 : : FlintTable("termlist", dbdir + "/termlist.", readonly, Z_DEFAULT_STRATEGY) { }
47 : :
48 : : /** Set the termlist data for document @a did.
49 : : *
50 : : * Any existing data is replaced.
51 : : *
52 : : * @param did The docid to set the termlist data for.
53 : : * @param doc The Xapian::Document object to read term data from.
54 : : * @param doclen The document length.
55 : : */
56 : : void set_termlist(Xapian::docid did, const Xapian::Document & doc,
57 : : flint_doclen_t doclen);
58 : :
59 : : /** Delete the termlist data for document @a did.
60 : : *
61 : : * @param did The docid to delete the termlist data for.
62 : : */
63 : 9879 : void delete_termlist(Xapian::docid did) { del(flint_docid_to_key(did)); }
64 : :
65 : : /// Returns the document length for document @a did.
66 : : flint_doclen_t get_doclength(Xapian::docid did) const;
67 : : };
68 : :
69 : : #endif // XAPIAN_INCLUDED_FLINT_TERMLISTTABLE_H
|