1 /** @file honey_postlisttable.h
2 * @brief Subclass of HoneyTable which holds postlists.
4 /* Copyright (C) 2007,2008,2009,2010,2013,2014,2015,2016 Olly Betts
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.
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.
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
21 #ifndef XAPIAN_INCLUDED_HONEY_POSTLISTTABLE_H
22 #define XAPIAN_INCLUDED_HONEY_POSTLISTTABLE_H
24 #include <xapian/constants.h>
25 #include <xapian/types.h>
27 #include "honey_inverter.h"
28 #include "honey_postlist.h"
29 #include "honey_table.h"
37 class HoneyPostListTable
: public HoneyTable
{
39 /** Create a new HoneyPostListTable object.
41 * This method does not create or open the table on disk - you
42 * must call the create() or open() methods respectively!
44 * @param dbdir The directory the honey database is stored in.
45 * @param readonly true if we're opening read-only, else false.
47 HoneyPostListTable(const std::string
& dbdir
, bool readonly
)
48 : HoneyTable("postlist", dbdir
+ "/postlist.", readonly
) { }
50 HoneyPostListTable(int fd
, off_t offset_
, bool readonly
)
51 : HoneyTable("postlist", fd
, offset_
, readonly
) { }
53 bool term_exists(const std::string
& term
) const {
54 return key_exists(pack_honey_postlist_key(term
));
57 HoneyPostList
* open_post_list(const HoneyDatabase
* db
,
58 const std::string
& term
,
61 void get_freqs(const std::string
& term
,
62 Xapian::doccount
* termfreq_ptr
,
63 Xapian::termcount
* collfreq_ptr
) const;
65 void get_used_docid_range(Xapian::docid
& first
, Xapian::docid
& last
) const;
67 std::string
get_metadata(const std::string
& key
) const {
69 (void)get_exact_entry(std::string("\0", 2) + key
, value
);
73 void merge_doclen_changes(const std::map
<Xapian::docid
, Xapian::termcount
>& changes
) {
74 // Honey doesn't support update currently.
78 void merge_changes(const std::string
& term
,
79 const HoneyInverter::PostingChanges
& changes
) {
80 // Honey doesn't support update currently.
86 #endif // XAPIAN_INCLUDED_HONEY_POSTLISTTABLE_H