Jim Lynch
2004-Sep-08 14:51 UTC
[Xapian-discuss] How can I get a list of all the document reference numbers from a db?
I had a problem while initially loading my databases. The system went down and when it came back up the db_lock files were still there. Scriptindex aborted but my script that was driving it didn't detect that situation and removed all the files that were left to still index. I don't really want to start over since I had a few days invested in loading the db. I'd like to get a list of all the documents in the db so I can compare to the source and reload just the missing ones. My index file looks like: reference : field=url boolean=Q unique=Q date : field date=unix stringdate: field index=XC value=1 body : index summary : field=sample title: field index=XT value=2 status: field index=XS assigned: field index=XA db: field index=XB value=3 Reference is the field I'd like to extract. Thanks, Jim.
Olly Betts
2004-Sep-08 15:00 UTC
[Xapian-discuss] How can I get a list of all the document reference numbers from a db?
On Wed, Sep 08, 2004 at 09:51:26AM -0400, Jim Lynch wrote:> I'd like to get a list of all the documents in the db > so I can compare to the source and reload just the missing ones. > > My index file looks like: > > reference : field=url boolean=Q unique=Q > [...] > > Reference is the field I'd like to extract.Something like this (totally untested) program: #include <xapian.h> #include <iostream> using namespace std; int main(int argc, char ** argv) { if (!argv[1]) exit(1); Xapian::Database db = Xapian::Auto::open(argv[1]); TermIterator t = db.allterms_begin(); const TermIterator end = db.allterms_end(); t.skip_to("Q"); while (t != end) { if ((*t)[0] != 'Q') break; cout << *t << endl; ++t; } } Cheers, Olly
Jim Lynch
2004-Sep-08 16:08 UTC
[Xapian-discuss] How can I get a list of all the document reference numbers from a db?
Yep, that did it. Thanks, Jim. Eric B. Ridge wrote:>> I must be missing something. > > > I think you also want to be using namespace Xapian. > > like so: > >> #include <xapian.h> >> #include <iostream> >> using namespace std; > > using namespace Xapian; > > eric