1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
/** @file contiguousalldocspostlist.h
* @brief Iterate all document ids when they form a contiguous range.
*/
/* Copyright (C) 2007,2008,2009,2011 Olly Betts
* Copyright (C) 2009 Lemur Consulting Ltd
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef XAPIAN_INCLUDED_CONTIGUOUSALLDOCSPOSTLIST_H
#define XAPIAN_INCLUDED_CONTIGUOUSALLDOCSPOSTLIST_H
#include <string>
#include "database.h"
#include "api/leafpostlist.h"
/// A PostList iteratating all docids when they form a contiguous range.
class ContiguousAllDocsPostList : public LeafPostList {
/// Don't allow assignment.
void operator=(const ContiguousAllDocsPostList &);
/// Don't allow copying.
ContiguousAllDocsPostList(const ContiguousAllDocsPostList &);
/// The database we're iterating over.
Xapian::Internal::intrusive_ptr<const Xapian::Database::Internal> db;
/// The current document id.
Xapian::docid did;
/// The number of documents in the database.
Xapian::doccount doccount;
public:
/// Constructor.
ContiguousAllDocsPostList(Xapian::Internal::intrusive_ptr<const Xapian::Database::Internal> db_,
Xapian::doccount doccount_)
: LeafPostList(std::string()),
db(db_), did(0), doccount(doccount_) { }
/** Return the term frequency.
*
* For an all documents postlist, this is the number of documents in the
* database.
*/
Xapian::doccount get_termfreq() const;
/// Return the current docid.
Xapian::docid get_docid() const;
/// Return the length of current document.
Xapian::termcount get_doclength() const;
/// Return the number of unique terms.
Xapian::termcount get_unique_terms() const;
/// Always return 1 (wdf isn't totally meaningful for us).
Xapian::termcount get_wdf() const;
/// Throws InvalidOperationError.
PositionList *read_position_list();
/// Throws InvalidOperationError.
PositionList * open_position_list() const;
/// Advance to the next document.
PostList * next(double w_min);
/// Skip ahead to next document with docid >= target.
PostList * skip_to(Xapian::docid target, double w_min);
/// Return true if and only if we're off the end of the list.
bool at_end() const;
/// Return a string description of this object.
std::string get_description() const;
};
#endif // XAPIAN_INCLUDED_CONTIGUOUSALLDOCSPOSTLIST_H
|