Index/Store something Unique for each document. Such as DB ID or Unique
URL/Path, etc.
Retrieve document by this unique value, and get its Lucene Document ID
Delete by this ID.


 
--
Eric Marden


-----Original Message-----
From: Mathew Byrne [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 18, 2008 4:25 AM
To: [email protected]
Subject: [fw-general] Updating Documents with Lucene

The documentation for Zend_Search_Lucene isn't really clear about how to
find existing documents in the current index. Take the following from
the docs:
$removePath = ...;
$hits = $index->find('path:' . $removePath); foreach ($hits as $hit) {
     $index->delete($hit->id);
}
Now I assume that this means that you've registered a field named 'path'
for each document in the index.
For my particular application pages are identified in the index and in
the database by an integer identifier. But for some reason the following
doesn't work correctly:

$page = ...;
$hits = $index->find('pid:' . (int) $page->getId (); // Doesn't return
any hits!

I have an inkling that the $index->find () method is stripping out all
non-alphabetical values. Is this the case and is there a work around for
this??

--
Mathew Byrne
http://www.matbyrne.com/

Reply via email to