[Xapian-discuss] Latest document of a database?
Olly Betts
olly@survex.com
Tue, 1 Jun 2004 17:12:45 +0100
On Tue, Jun 01, 2004 at 05:28:15PM +0200, Robert Pollak wrote:
> to re-synchronize the index after restoring an old index backup, it
> would be useful to get the id of the most recently added document.
>
> Is this simply the highest docid?
If you ignore the possibility that the most recently added document
might have since been deleted, then it will have the highest docid
(add_document() never reuses a docid).
> Is there a way to get this via the API? I didn't find one in database.h.
There isn't.
It wouldn't be hard to expose for quartz (at least the highest docid
*ever* used by a database is readily available and that's probably what
you're actually after). And I think any updatable database must be able
to know this efficiently as otherwise it couldn't implement add_document
efficiently...
Cheers,
Olly