root / tags / 1.0.8 / xapian-core / backends / flint / flint_alldocspostlist.h

Revision 9440, 2.3 kB (checked in by olly, 15 months ago)

api/postlist.cc,backends/flint/flint_alldocspostlist.cc,
backends/flint/flint_alldocspostlist.h,common/postlist.h,matcher/:
Eliminate several implementations of open_position_list and
read_position_list in favour of default ones in the PostList? base
class which throw InvalidOperationError?. Change the default
get_wdf implementation to also throw InvalidOperationError?.

Line 
1/** @file flint_alldocspostlist.h
2 * @brief A PostList which iterates over all documents in a FlintDatabase.
3 */
4/* Copyright (C) 2006,2007 Olly Betts
5 *
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.
10 *
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.
15 *
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
19 */
20
21#ifndef XAPIAN_INCLUDED_FLINT_ALLDOCSPOSTLIST_H
22#define XAPIAN_INCLUDED_FLINT_ALLDOCSPOSTLIST_H
23
24#include <string>
25
26#include "leafpostlist.h"
27
28class FlintAllDocsPostList : public LeafPostList {
29    /// Don't allow assignment.
30    void operator=(const FlintAllDocsPostList &);
31
32    /// Don't allow copying.
33    FlintAllDocsPostList(const FlintAllDocsPostList &);
34
35    /// Set @a current_did from @a cursor->current_key.
36    PostList * read_did_from_current_key();
37
38    /// The database we're iterating over.
39    Xapian::Internal::RefCntPtr<const FlintDatabase> db;
40
41    /// The number of documents in the database.
42    Xapian::doccount doccount;
43
44    /// Cursor running over termlist table keys.
45    AutoPtr<FlintCursor> cursor;
46
47    /// The current document id.
48    Xapian::docid current_did;
49
50  public:
51    FlintAllDocsPostList(Xapian::Internal::RefCntPtr<const FlintDatabase> db_,
52                         Xapian::doccount doccount_)
53      : db(db_), doccount(doccount_), cursor(db->termlist_table.cursor_get()),
54        current_did(0)
55    {
56        cursor->find_entry("");
57    }
58
59    ~FlintAllDocsPostList();
60
61    Xapian::doccount get_termfreq() const;
62
63    Xapian::docid get_docid() const;
64
65    Xapian::doclength get_doclength() const;
66
67    Xapian::termcount get_wdf() const;
68
69    PostList * next(Xapian::weight w_min);
70
71    PostList * skip_to(Xapian::docid desired_did, Xapian::weight w_min);
72
73    bool at_end() const;
74
75    std::string get_description() const;
76};
77
78#endif // XAPIAN_INCLUDED_FLINT_ALLDOCSPOSTLIST_H
Note: See TracBrowser for help on using the browser.