xapian-core  2.0.0
honey_postlisttable.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2007,2008,2009,2010,2013,2014,2015,2016,2018,2024 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, see
18  * <https://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef XAPIAN_INCLUDED_HONEY_POSTLISTTABLE_H
22 #define XAPIAN_INCLUDED_HONEY_POSTLISTTABLE_H
23 
24 #include <xapian/constants.h>
25 #include <xapian/types.h>
26 
27 #include "honey_inverter.h"
28 #include "honey_postlist.h"
29 #include "honey_table.h"
30 #include "pack.h"
31 
32 #include <string>
33 #include <string_view>
34 
35 class HoneyDatabase;
36 class PostingChanges;
37 
39  public:
48  HoneyPostListTable(const std::string& dbdir, bool readonly)
49  : HoneyTable("postlist", dbdir + "/postlist.", readonly) { }
50 
51  HoneyPostListTable(int fd, off_t offset_, bool readonly)
52  : HoneyTable("postlist", fd, offset_, readonly) { }
53 
54  bool term_exists(std::string_view term) const {
56  }
57 
59  std::string_view term,
60  bool need_read_pos) const;
61 
62  void get_freqs(std::string_view term,
63  Xapian::doccount* termfreq_ptr,
64  Xapian::termcount* collfreq_ptr) const;
65 
67  Xapian::docid& first,
68  Xapian::docid& last) const;
69 
70  Xapian::termcount get_wdf_upper_bound(std::string_view term) const;
71 
72  std::string get_metadata(std::string_view key) const {
73  using namespace std::string_literals;
74  std::string value;
75  (void)get_exact_entry("\0\0"s.append(key), value);
76  return value;
77  }
78 
79  void merge_doclen_changes(const std::map<Xapian::docid,
80  Xapian::termcount>& changes) {
81  // Honey doesn't support update currently.
82  (void)changes;
83  }
84 
85  void merge_changes(const std::string& term,
86  const HoneyInverter::PostingChanges& changes) {
87  // Honey doesn't support update currently.
88  (void)term;
89  (void)changes;
90  }
91 };
92 
93 #endif // XAPIAN_INCLUDED_HONEY_POSTLISTTABLE_H
Database using honey backend.
Class for storing the changes in frequencies for a term.
void merge_changes(const std::string &term, const HoneyInverter::PostingChanges &changes)
void merge_doclen_changes(const std::map< Xapian::docid, Xapian::termcount > &changes)
void get_used_docid_range(Xapian::doccount doccount, Xapian::docid &first, Xapian::docid &last) const
HoneyPostListTable(const std::string &dbdir, bool readonly)
Create a new HoneyPostListTable object.
bool term_exists(std::string_view term) const
void get_freqs(std::string_view term, Xapian::doccount *termfreq_ptr, Xapian::termcount *collfreq_ptr) const
HoneyPostListTable(int fd, off_t offset_, bool readonly)
HoneyPostList * open_post_list(const HoneyDatabase *db, std::string_view term, bool need_read_pos) const
Xapian::termcount get_wdf_upper_bound(std::string_view term) const
std::string get_metadata(std::string_view key) const
PostList in a honey database.
bool get_exact_entry(std::string_view key, std::string *tag) const
Definition: honey_table.cc:247
bool key_exists(const std::string &key) const
Definition: honey_table.h:667
Constants in the Xapian namespace.
string term
HoneyInverter class which "inverts the file".
PostList in a honey database.
HoneyTable class.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Definition: types.h:64
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Definition: types.h:37
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Definition: types.h:51
Pack types into strings and unpack them again.
std::string pack_honey_postlist_key(std::string_view term)
Definition: pack.h:602
typedefs for Xapian