xapian-core  2.0.0
honey_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_HONEY_SPELLINGWORDSLIST_H
23 #define XAPIAN_INCLUDED_HONEY_SPELLINGWORDSLIST_H
24 
25 #include "backends/alltermslist.h"
26 #include "honey_spelling.h"
27 #include "honey_cursor.h"
28 
29 class HoneyDatabase;
30 
34 
37 
40 
45 
53 
55  void read_termfreq() const;
56 
57  public:
58  HoneySpellingWordsList(const HoneyDatabase* database_, HoneyCursor* cursor_)
59  : database(database_), cursor(cursor_)
60  {
61  // Set the cursor to its end to signal we haven't started yet. Then
62  // if the first action is next() we can move the cursor to the first
63  // word with:
64  //
65  // cursor.find_entry_ge(string(1, KEY_PREFIX_WORD));
66  cursor->to_end();
67  }
68 
71 
73 
80 
82  TermList* next();
83 
85  TermList* skip_to(std::string_view term);
86 };
87 
88 #endif /* XAPIAN_INCLUDED_HONEY_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
void to_end()
Definition: honey_cursor.h:92
Database using honey backend.
Xapian::doccount get_termfreq() const
Returns the term frequency of the current term.
void operator=(const HoneySpellingWordsList &)
Assignment is not allowed.
Xapian::Internal::intrusive_ptr< const HoneyDatabase > database
Keep a reference to our database to stop it being deleted.
HoneyCursor * cursor
A cursor which runs through the spelling table reading termnames from the keys.
HoneySpellingWordsList(const HoneySpellingWordsList &)
Copying is not allowed.
Xapian::termcount termfreq
The term frequency of the term at the current position.
TermList * next()
Advance to the next term in the list.
TermList * skip_to(std::string_view term)
Advance to the first term which is >= term.
void read_termfreq() const
Read and cache the term frequency.
HoneySpellingWordsList(const HoneyDatabase *database_, HoneyCursor *cursor_)
Xapian::termcount get_approx_size() const
Return approximate size of this termlist.
Abstract base class for termlists.
Definition: termlist.h:42
string term
HoneyCursor class.
Spelling correction data for a honey 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