On Apr 19, 2008, at 1:48 AM, Eric Marden wrote:
Index/Store something Unique for each document. Such as DB ID or
Unique
URL/Path, etc.
Ok, I'm doing that:
$doc->addField (Zend_Search_Lucene_Field::UnIndexed ('pid', $page-
>getId ()));
Retrieve document by this unique value, and get its Lucene Document ID
Delete by this ID.
Ok, so I'd assume the following would work:
$hits = $index->find('pid:' . (int) $page->getId ());
But as far as I can tell this is not returning anything. Should I be
storing this unique identifier in any particular type of field? Will
integer values be stripped out or something?
--
Eric Marden
-----Original Message-----
From: Mathew Byrne [mailto:[EMAIL PROTECTED]
Sent: Friday, April 18, 2008 4:25 AM
To: fw-general@lists.zend.com
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/