2 * @brief test database contents and consistency.
4 /* Copyright (C) 2010 Richard Boulton
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.
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.
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
21 #ifndef XAPIAN_INCLUDED_DBCHECK_H
22 #define XAPIAN_INCLUDED_DBCHECK_H
27 /** Convert the list of positions in a positionlist to a string.
29 * @param it The start iterator for the positionlist. This will be moved.
30 * @param end The end iterator for the positionlist.
31 * @param count If not NULL, a pointer to a value which will be set to the
32 * number of positions found.
35 positions_to_string(Xapian::PositionIterator
& it
,
36 const Xapian::PositionIterator
& end
,
37 Xapian::termcount
* count
= NULL
);
39 /** Convert the list of postings in a postlist to a string.
41 * This will include positional information when such information is present.
44 postlist_to_string(const Xapian::Database
& db
, const std::string
& tname
);
46 /** Convert the list of terms in a document to a string.
48 * This will include positional information when such information is present.
51 docterms_to_string(const Xapian::Database
& db
, Xapian::docid did
);
53 /// Convert statistics about a document to a string.
55 docstats_to_string(const Xapian::Database
& db
, Xapian::docid did
);
57 /// Convert statistics about a term to a string.
59 termstats_to_string(const Xapian::Database
& db
, const std::string
& term
);
61 /** Check consistency of database and statistics.
63 * Raises a TestFail exception if the database is inconsistent.
66 dbcheck(const Xapian::Database
& db
,
67 Xapian::doccount expected_doccount
,
68 Xapian::docid expected_lastdocid
);
70 #endif /* XAPIAN_INCLUDED_DBCHECK_H */