2 * @brief Adapter class for a TermList in a multidatabase
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
23 #include "multi_termlist.h"
25 #include <xapian/database.h>
27 #include "backends/databaseinternal.h"
28 #include "backends/multi.h"
33 MultiTermList::MultiTermList(const Xapian::Database::Internal
* db_
,
34 TermList
* real_termlist_
)
35 : real_termlist(real_termlist_
), db(db_
)
39 MultiTermList::~MultiTermList()
45 MultiTermList::get_approx_size() const
47 return real_termlist
->get_approx_size();
51 MultiTermList::get_wdf() const
53 return real_termlist
->get_wdf();
57 MultiTermList::get_termfreq() const
59 Xapian::doccount result
;
60 db
->get_freqs(real_termlist
->get_termname(), &result
, NULL
);
67 TermList
* res
= real_termlist
->next();
69 // No more entries (prune shouldn't happen).
70 Assert(res
== real_termlist
);
73 current_term
= real_termlist
->get_termname();
78 MultiTermList::skip_to(std::string_view term
)
80 TermList
* res
= real_termlist
->skip_to(term
);
82 // No more entries (prune shouldn't happen).
83 Assert(res
== real_termlist
);
86 current_term
= real_termlist
->get_termname();
91 MultiTermList::positionlist_count() const
93 return real_termlist
->positionlist_count();
97 MultiTermList::positionlist_begin() const
99 return real_termlist
->positionlist_begin();