[Xapian-discuss] Why is a "DocNotFoundError" when deleting a
document a Fatal error in php?
Arjen van der Meijden
acmmailing at tweakers.net
Fri Oct 28 08:54:44 BST 2005
It turns out that also working around the issue using something like
this won't work:
$doc = Database_get_document($database, $docId);
if($doc != null)
{
WritableDatabase_delete_document($database, $docId);
WritableDatabase_flush($database);
}
The get_document appearantly also yields a fatal error. In php it is
common return false or null in a "it doesn't exist" case.
Best regards,
Arjen
Arjen van der Meijden wrote:
> Currently I've built a php-based indexer for a new set-up were we'd like
> to use Xapian as back-end. All works quite well, except deleting a
> document. It may occur that the index has not been synced before a
> document is to be deleted again.
>
> I.e. a document is queued to be added, but also queued to be deleted.
> Now the prettiest way to handle that is just to remove the document from
> the queue, but that's a lot of extra checks for a few rare cases I don't
> really like to do.
> So I basically just delete the document, if it doesn't exist well,
> that's perfectly ok for me. But Xapian considers it an error and throws
> the DocNotFoundError, which gets wrapped to a Fatal Error.
> PHP cannot recover from such a situation as easily as C or Java can
> (try-catch doesn't exist in php4, nor would it work for such a situation
> in 5 I think).
> Of course I can write my own error handler in php, but it may also be
> worth to consider to lower the severity of such a case?
>
> Best regards,
>
> Arjen
>
> _______________________________________________
> Xapian-discuss mailing list
> Xapian-discuss at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-discuss
>
More information about the Xapian-discuss
mailing list