xapian-core  1.4.25
chert_spellingwordslist.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2005,2008,2011 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, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef XAPIAN_HGUARD_CHERT_SPELLINGWORDSLIST_H
23 #define XAPIAN_HGUARD_CHERT_SPELLINGWORDSLIST_H
24 
25 #include "backends/alltermslist.h"
26 #include "backends/database.h"
27 #include "chert_spelling.h"
28 
29 class ChertCursor;
30 
34 
36  void operator=(const ChertSpellingWordsList &);
37 
40 
45 
53 
55  void read_termfreq() const;
56 
57  public:
59  ChertCursor * 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 
74  std::string get_termname() const;
75 
82 
84  TermList * next();
85 
87  TermList * skip_to(const std::string &tname);
88 
90  bool at_end() const;
91 };
92 
93 #endif /* XAPIAN_HGUARD_CHERT_SPELLINGWORDSLIST_H */
A cursor pointing to a position in a Btree table, for reading several entries in order, or finding approximate matches.
Definition: chert_cursor.h:66
ChertCursor * cursor
A cursor which runs through the spelling table reading termnames from the keys.
TermList * next()
Advance to the next term in the list.
Xapian::termcount termfreq
The term frequency of the term at the current position.
Abstract base class for termlists.
Definition: termlist.h:39
void operator=(const ChertSpellingWordsList &)
Assignment is not allowed.
Xapian::doccount get_termfreq() const
Returns the term frequency of the current term.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Definition: types.h:72
std::string get_termname() const
Returns the current termname.
void read_termfreq() const
Read and cache the term frequency.
Abstract base class for iterating all terms in a database.
Spelling correction data for a chert database.
ChertSpellingWordsList(Xapian::Internal::intrusive_ptr< const Xapian::Database::Internal > database_, ChertCursor *cursor_)
bool at_end() const
True if we&#39;re off the end of the list.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Definition: types.h:38
Abstract base class for iterating all terms in a database.
Definition: alltermslist.h:27
TermList * skip_to(const std::string &tname)
Advance to the first term which is >= tname.
ChertSpellingWordsList(const ChertSpellingWordsList &)
Copying is not allowed.
bool find_entry(const string &key)
Position the cursor on the highest entry with key <= key.
Xapian::Internal::intrusive_ptr< const Xapian::Database::Internal > database
Keep a reference to our database to stop it being deleted.