2 * @brief A termlist containing all terms in a glass database.
4 /* Copyright (C) 2005,2007,2008,2009,2010,2011,2024 Olly Betts
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (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
22 #ifndef XAPIAN_INCLUDED_GLASS_ALLTERMSLIST_H
23 #define XAPIAN_INCLUDED_GLASS_ALLTERMSLIST_H
25 #include "backends/alltermslist.h"
26 #include "glass_database.h"
27 #include "glass_postlist.h"
29 #include <string_view>
33 class GlassAllTermsList
: public AllTermsList
{
34 /// Copying is not allowed.
35 GlassAllTermsList(const GlassAllTermsList
&);
37 /// Assignment is not allowed.
38 void operator=(const GlassAllTermsList
&);
40 /// Keep a reference to our database to stop it being deleted.
41 Xapian::Internal::intrusive_ptr
<const GlassDatabase
> database
;
43 /** A cursor which runs through the postlist table reading termnames from
48 /// The prefix to restrict the terms to.
51 /** The term frequency of the term at the current position.
53 * If this value is zero, then we haven't read the term frequency for the
54 * current term yet. We need to call read_termfreq() to read this.
56 mutable Xapian::doccount termfreq
;
58 /// Read and cache the term frequency.
59 void read_termfreq() const;
62 GlassAllTermsList(Xapian::Internal::intrusive_ptr
<const GlassDatabase
> database_
,
63 std::string_view prefix_
)
64 : database(database_
), cursor(NULL
), prefix(prefix_
), termfreq(0) { }
69 Xapian::termcount
get_approx_size() const;
71 /** Returns the term frequency of the current term.
73 * Either next() or skip_to() must have been called before this
74 * method can be called.
76 Xapian::doccount
get_termfreq() const;
78 /// Advance to the next term in the list.
81 /// Advance to the first term which is >= tname.
82 TermList
* skip_to(std::string_view tname
);
85 #endif /* XAPIAN_INCLUDED_GLASS_ALLTERMSLIST_H */