[Xapian-discuss] replace_document and delete_document with string UID not working in PHP bindings?
Richard Boulton
richard at tartarus.org
Tue Nov 3 11:46:12 GMT 2009
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