diff options
| author | Carl Worth <cworth@cworth.org> | 2009-10-13 08:29:59 -0700 |
|---|---|---|
| committer | Carl Worth <cworth@cworth.org> | 2009-10-13 08:54:35 -0700 |
| commit | c8532ce25d060398561a3a45a227628d50674dea (patch) | |
| tree | f44c24794c267486294a9bc219ac495582537761 | |
| parent | 26795d64e6150b543d850c1e882a9d1395b58d9e (diff) | |
xapian-dump: Fix to dump all terms for each document ID.
| -rw-r--r-- | xapian-dump.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/xapian-dump.cc b/xapian-dump.cc index 0ab5e32c..9049b452 100644 --- a/xapian-dump.cc +++ b/xapian-dump.cc @@ -1,4 +1,4 @@ -/* xapian-dump: Dump all document IDs from a Xapian database +/* xapian-dump: Dump document IDs and associated terms from a Xapian database * * Copyright © 2009 Carl Worth * @@ -25,6 +25,17 @@ using namespace std; +static void +print_document (Xapian::Database db, Xapian::docid id) +{ + Xapian::TermIterator i; + + printf ("Document %u:\n", id); + + for (i = db.termlist_begin (id); i != db.termlist_end (id); i++) + cout << "\t" << *i << endl; +} + int main (int argc, char *argv[]) { @@ -47,7 +58,8 @@ main (int argc, char *argv[]) db = Xapian::Database (database_path); for (i = db.postlist_begin (""); i != db.postlist_end (""); i++) { doc_id = *i; - printf ("Found document %u\n", doc_id); + + print_document (db, doc_id); } } catch (const Xapian::Error &error) { |
