Fix java examples and related docs on how to run them
[xapian.git] / xapian-core / tests / dbcheck.h
blob9b691dc5c65e66e34636779a84add94f57972f1b
1 /** @file dbcheck.h
2 * @brief test database contents and consistency.
3 */
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
24 #include <xapian.h>
25 #include <string>
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.
34 std::string
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.
43 std::string
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.
50 std::string
51 docterms_to_string(const Xapian::Database & db, Xapian::docid did);
53 /// Convert statistics about a document to a string.
54 std::string
55 docstats_to_string(const Xapian::Database & db, Xapian::docid did);
57 /// Convert statistics about a term to a string.
58 std::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.
65 void
66 dbcheck(const Xapian::Database & db,
67 Xapian::doccount expected_doccount,
68 Xapian::docid expected_lastdocid);
70 #endif /* XAPIAN_INCLUDED_DBCHECK_H */