xapian-core  2.0.0
glass_spellingwordslist.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2005,2008,2009,2010,2011,2017,2024 Olly Betts
5  * Copyright (C) 2007 Lemur Consulting Ltd
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, see
19  * <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef XAPIAN_INCLUDED_GLASS_SPELLINGWORDSLIST_H
23 #define XAPIAN_INCLUDED_GLASS_SPELLINGWORDSLIST_H
24 
25 #include "backends/alltermslist.h"
26 #include "glass_spelling.h"
27 #include "glass_cursor.h"
28 
29 class GlassDatabase;
30 
34 
37 
40 
45 
53 
55  void read_termfreq() const;
56 
57  public:
59  GlassCursor * cursor_)
60  : database(database_), cursor(cursor_), termfreq(0) {
61  // Seek to the entry before the first key with a "W" prefix, so the
62  // first next() will advance us to the first such entry.
63  cursor->find_entry(std::string("W", 1));
64  }
65 
68 
70 
77 
79  TermList * next();
80 
82  TermList* skip_to(std::string_view tname);
83 };
84 
85 #endif /* XAPIAN_INCLUDED_GLASS_SPELLINGWORDSLIST_H */
Abstract base class for iterating all terms in a database.
Abstract base class for iterating all terms in a database.
Definition: alltermslist.h:27
A cursor pointing to a position in a Btree table, for reading several entries in order,...
Definition: glass_cursor.h:148
bool find_entry(const string &key)
Position the cursor on the highest entry with key <= key.
A backend designed for efficient indexing and retrieval, using compressed posting lists and a btree s...
void operator=(const GlassSpellingWordsList &)
Assignment is not allowed.
Xapian::Internal::intrusive_ptr< const GlassDatabase > database
Keep a reference to our database to stop it being deleted.
GlassSpellingWordsList(Xapian::Internal::intrusive_ptr< const GlassDatabase > database_, GlassCursor *cursor_)
void read_termfreq() const
Read and cache the term frequency.
Xapian::termcount get_approx_size() const
Return approximate size of this termlist.
Xapian::termcount termfreq
The term frequency of the term at the current position.
TermList * next()
Advance to the next term in the list.
GlassSpellingWordsList(const GlassSpellingWordsList &)
Copying is not allowed.
GlassCursor * cursor
A cursor which runs through the spelling table reading termnames from the keys.
Xapian::doccount get_termfreq() const
Returns the term frequency of the current term.
TermList * skip_to(std::string_view tname)
Advance to the first term which is >= tname.
Abstract base class for termlists.
Definition: termlist.h:42
Interface to Btree cursors.
Spelling correction data for a glass database.
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