Hi Dino,
That's not good idea to use internal document id for the
synchronization. It may be changed (ex. after index optimization).
Use special Keyword field to store document unique identifier (surrogate
or natural). Document could be retrieved by the value of this field fast
enough:
---------------------------------------
$docId = reset($index->termDocs(new
Zend_Search_Lucene_Index_Term($docUniqueId, $idField)));
If ($docId !== false) {
$doc = $index->getDocument($docId);
} else {
...
}
------------------
With best regards,
Alexander Veremyev.
> -----Original Message-----
> From: dinok [mailto:[EMAIL PROTECTED]
> Sent: Saturday, September 08, 2007 8:19 PM
> To: [email protected]
> Subject: [fw-general] Zend_Search_Lucene, getting $doc id
> while indexing
>
>
> Hi guys,
>
> Is there a possibility to get the current id of a new
> document in the index?
> For example something like this:
>
> $index->addDocument($doc);
> $docid = $doc->id;
>
> Because I need these ids to synchronisize my database (There
> is a column with lucene_id) with the index.
> This is needed if i want to edit/delete something in the
> database and update the index.
> Or is ther another possibility to do this?
>
> Best regards
> Dino
> --
> View this message in context:
> http://www.nabble.com/Zend_Search_Lucene%2C-getting-%24doc-id-
> while-indexing-tf4406453s16154.html#a12571173
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>