<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Hi, Olly,<br>
<br>
Please bear with me. C++ isn't my strongest language. I put a
makefile together to get this to compile that looks like<br>
<font face="Courier New, Courier, monospace"><br>
cat Makefile<br>
INCLUDE=/usr/local/include<br>
<br>
listref: listref.cc<br>
g++ -I${INCLUDE} -c -o listref.o -g listref.cc<br>
</font><br>
(I called the program listref.cc)<br>
and get:<br>
<br>
make<br>
g++ -c -o listref.o listref.cc<br>
listref.cc: In function `int main(int, char**)':<br>
listref.cc:8: error: `TermIterator' undeclared (first use this function)<br>
listref.cc:8: error: (Each undeclared identifier is reported only once
for each <br>
function it appears in.)<br>
listref.cc:8: error: parse error before `=' token<br>
listref.cc:9: error: ISO C++ forbids declaration of `TermIterator' with
no type<br>
listref.cc:9: error: uninitialized const `TermIterator'<br>
listref.cc:9: error: parse error before `=' token<br>
listref.cc:10: error: `t' undeclared (first use this function)<br>
listref.cc:11: error: `end' undeclared (first use this function)<br>
<br>
xapian.h is in /usr/local/include and it includes xapian/termiterator.h
and both are readable. <br>
<br>
I must be missing something. <br>
<br>
Jim.<br>
<br>
Olly Betts wrote:<br>
<blockquote type="cite" cite="mid20040908140020.GD26297@survex.com">
<pre wrap="">On Wed, Sep 08, 2004 at 09:51:26AM -0400, Jim Lynch wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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.
</pre>
</blockquote>
<pre wrap=""><!---->
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
</pre>
</blockquote>
</body>
</html>