[Xapian-discuss] How can I get a list of all the document
reference numbers from a db?
Olly Betts
olly at survex.com
Wed Sep 8 15:00:20 BST 2004
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
More information about the Xapian-discuss
mailing list