Mark overriding virtual methods in cluster API
[xapian.git] / xapian-core / backends / multi / multi_termlist.cc
blob3076fa7462b72de7d669391abce4d7c7255057b1
1 /** @file
2 * @brief Adapter class for a TermList in a multidatabase
3 */
4 /* Copyright (C) 2007,2008,2009,2011,2017,2024 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 #include <config.h>
23 #include "multi_termlist.h"
25 #include <xapian/database.h>
27 #include "backends/databaseinternal.h"
28 #include "backends/multi.h"
29 #include "omassert.h"
31 using namespace std;
33 MultiTermList::MultiTermList(const Xapian::Database::Internal* db_,
34 TermList* real_termlist_)
35 : real_termlist(real_termlist_), db(db_)
39 MultiTermList::~MultiTermList()
41 delete real_termlist;
44 Xapian::termcount
45 MultiTermList::get_approx_size() const
47 return real_termlist->get_approx_size();
50 Xapian::termcount
51 MultiTermList::get_wdf() const
53 return real_termlist->get_wdf();
56 Xapian::doccount
57 MultiTermList::get_termfreq() const
59 Xapian::doccount result;
60 db->get_freqs(real_termlist->get_termname(), &result, NULL);
61 return result;
64 TermList *
65 MultiTermList::next()
67 TermList* res = real_termlist->next();
68 if (res) {
69 // No more entries (prune shouldn't happen).
70 Assert(res == real_termlist);
71 return this;
73 current_term = real_termlist->get_termname();
74 return NULL;
77 TermList*
78 MultiTermList::skip_to(std::string_view term)
80 TermList* res = real_termlist->skip_to(term);
81 if (res) {
82 // No more entries (prune shouldn't happen).
83 Assert(res == real_termlist);
84 return this;
86 current_term = real_termlist->get_termname();
87 return NULL;
90 Xapian::termcount
91 MultiTermList::positionlist_count() const
93 return real_termlist->positionlist_count();
96 PositionList*
97 MultiTermList::positionlist_begin() const
99 return real_termlist->positionlist_begin();