[Xapian-discuss] replace_document and delete_document with string UID not working in PHP bindings?

Pascal Opitz contact at pascalopitz.com
Tue Nov 3 12:05:05 GMT 2009


Brilliant, that works.

I was _foolishly assuming_ that replace_document would manage that by  
itself.
Didn't even cross my mind that I had to add the term manually.

Thank you very much.

On 3 Nov 2009, at 11:46, Richard Boulton wrote:

> 2009/11/3 Pascal Opitz <contact at pascalopitz.com>:
>> I am currently trying to index documents using the replace_document
>> method, and am passing a string instead of a docid:
>>
>> $this->xapian_write_db->replace_document((string)
>> self::XAPIAN_PREFIX_UNIQUE . $row['item_guid'], $doc);
>
> You need to add the unique ID string to the document, too.  Otherwise,
> when the next call to replace_document() looks for the term, it won't
> find it.  replace_document() doesn't automatically add the term
> supplied to the document.
>
>
> My PHP is very rusty, but something like:
>
> $docid = (string)self::XAPIAN_PREFIX_UNIQUE . $row['item_guid'];
> $doc->add_term($docid, 0);
> $this->xapian_write_db->replace_document($docid, $doc);
>
> -- 
> Richard




More information about the Xapian-discuss mailing list