[Xapian-discuss] How to check docid

Olly Betts olly at survex.com
Tue May 31 04:21:38 BST 2011


On Mon, May 30, 2011 at 10:06:41PM +0100, Andrew G. wrote:
> The problem I have is that some of the documents may not have been
> created - so I get an error. Now I could just ignore the error
> (try-recover), but what would be the recommended way to handle this
> situation?

If it's rare, I'd just catch the exceptions.

If it's pretty common, then the cost of the exception handling is
probably going to add up.  In that case you could sort the list of
document ids you want to remove, then check them against the list of all
document ids returned by iterating the postlist for the empty term:

http://xapian.org/docs/apidoc/html/classXapian_1_1Database.html#504d8e800384d12a8f9defee39362f5e

Perhaps there should be a way to tell delete_document() that it's OK
if the document doesn't exist.

Cheers,
    Olly



More information about the Xapian-discuss mailing list