root / tags / 1.0.8 / xapian-core / backends / flint / contiguousalldocspostlist.h
| Revision 9089, 2.9 kB (checked in by olly, 19 months ago) |
|---|
| Line | |
|---|---|
| 1 | /** @file contiguousalldocspostlist.h |
| 2 | * @brief Iterate all document ids when they form a contiguous range. |
| 3 | */ |
| 4 | /* Copyright (C) 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_CONTIGUOUSALLDOCSPOSTLIST_H |
| 22 | #define XAPIAN_INCLUDED_FLINT_CONTIGUOUSALLDOCSPOSTLIST_H |
| 23 | |
| 24 | #include <string> |
| 25 | |
| 26 | #include "database.h" |
| 27 | #include "leafpostlist.h" |
| 28 | |
| 29 | /// A PostList iteratating all docids when they form a contiguous range. |
| 30 | class ContiguousAllDocsPostList : public LeafPostList { |
| 31 | /// Don't allow assignment. |
| 32 | void operator=(const ContiguousAllDocsPostList &); |
| 33 | |
| 34 | /// Don't allow copying. |
| 35 | ContiguousAllDocsPostList(const ContiguousAllDocsPostList &); |
| 36 | |
| 37 | /// The database we're iterating over. |
| 38 | Xapian::Internal::RefCntPtr<const Xapian::Database::Internal> db; |
| 39 | |
| 40 | /// The current document id. |
| 41 | Xapian::docid did; |
| 42 | |
| 43 | /// The number of documents in the database. |
| 44 | Xapian::doccount doccount; |
| 45 | |
| 46 | public: |
| 47 | /// Constructor. |
| 48 | ContiguousAllDocsPostList(Xapian::Internal::RefCntPtr<const Xapian::Database::Internal> db_, |
| 49 | Xapian::doccount doccount_) |
| 50 | : db(db_), did(0), doccount(doccount_) { } |
| 51 | |
| 52 | /// Destructor. |
| 53 | ~ContiguousAllDocsPostList(); |
| 54 | |
| 55 | /** Return the term frequency. |
| 56 | * |
| 57 | * For an all documents postlist, this is the number of documents in the database. |
| 58 | */ |
| 59 | Xapian::doccount get_termfreq() const; |
| 60 | |
| 61 | /// Return the current docid. |
| 62 | Xapian::docid get_docid() const; |
| 63 | |
| 64 | /// Return the length of current document. |
| 65 | Xapian::doclength get_doclength() const; |
| 66 | |
| 67 | /// Always return 1 (wdf isn't totally meaningful for us). |
| 68 | Xapian::termcount get_wdf() const; |
| 69 | |
| 70 | /// Throws InvalidOperationError. |
| 71 | PositionList *read_position_list(); |
| 72 | |
| 73 | /// Throws InvalidOperationError. |
| 74 | PositionList * open_position_list() const; |
| 75 | |
| 76 | /// Advance to the next document. |
| 77 | PostList * next(Xapian::weight w_min); |
| 78 | |
| 79 | /// Skip ahead to next document with docid >= target. |
| 80 | PostList * skip_to(Xapian::docid target, Xapian::weight w_min); |
| 81 | |
| 82 | /// Return true if and only if we're off the end of the list. |
| 83 | bool at_end() const; |
| 84 | |
| 85 | /// Return a string description of this object. |
| 86 | std::string get_description() const; |
| 87 | }; |
| 88 | |
| 89 | #endif // XAPIAN_INCLUDED_FLINT_CONTIGUOUSALLDOCSPOSTLIST_H |
Note: See TracBrowser
for help on using the browser.
