projects
/
notmuch
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
26795d6
)
xapian-dump: Fix to dump all terms for each document ID.
author
Carl Worth
<cworth@cworth.org>
Tue, 13 Oct 2009 15:29:59 +0000
(08:29 -0700)
committer
Carl Worth
<cworth@cworth.org>
Tue, 13 Oct 2009 15:54:35 +0000
(08:54 -0700)
xapian-dump.cc
patch
|
blob
|
history
diff --git
a/xapian-dump.cc
b/xapian-dump.cc
index 0ab5e32c7cb6f4f1810a07ec026e903f0bc38a26..9049b45242b714600bc8a639c5dcfa8f6830cd50 100644
(file)
--- a/
xapian-dump.cc
+++ b/
xapian-dump.cc
@@
-1,4
+1,4
@@
-/* xapian-dump: Dump
all document ID
s from a Xapian database
+/* xapian-dump: Dump
document IDs and associated term
s from a Xapian database
*
* Copyright © 2009 Carl Worth
*
*
* Copyright © 2009 Carl Worth
*
@@
-25,6
+25,17
@@
using namespace std;
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[])
{
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;
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) {
}
} catch (const Xapian::Error &error) {